<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.opendap.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DennisHeimbigner</id>
	<title>OPeNDAP Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.opendap.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DennisHeimbigner"/>
	<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php/Special:Contributions/DennisHeimbigner"/>
	<updated>2026-05-09T07:43:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12317</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12317"/>
		<updated>2017-01-27T19:09:27Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.5&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Forgot to mention adding the special names section (5.3)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.18&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarified the reserved names section (5.3) to say that all names beginning with &amp;quot;_&amp;quot; are reserved, but that the reverse DNS case is preferred.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;_&amp;quot; is considered reserved. Note that if the receiver encounters such a name and has no information on how to process the name, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
A special case is when the &amp;quot;_&amp;quot; is followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information. This form of reserved name is preferred because it provides information about the organization that defined it.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;edu.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;edu.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner for defining the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12307</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12307"/>
		<updated>2016-12-18T22:19:27Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.5&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Forgot to mention adding the special names section (5.3)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.18&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarified the reserved names section (5.3) to say that all names beginning with &amp;quot;_&amp;quot; are reserved, but that the reverse DNS case is preferred.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;_&amp;quot; is considered reserved. Note that if the receiver encounters such a name and has no information on how to process the name, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
A special case is when the &amp;quot;_&amp;quot; is followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information. This form of reserved name is preferred because it provides information about the organization that defined it.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;edu.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;edu.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner for defining the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12306</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12306"/>
		<updated>2016-12-18T22:16:52Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Reserved Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.5&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Forgot to mention adding the special names section (5.3)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;_&amp;quot; is considered reserved. Note that if the receiver encounters such a name and has no information on how to process the name, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
A special case is when the &amp;quot;_&amp;quot; is followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information. This form of reserved name is preferred because it provides information about the organization that defined it.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;edu.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;edu.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner for defining the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12276</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12276"/>
		<updated>2016-12-05T23:37:36Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.5&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Forgot to mention adding the special names section (5.3)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;_&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;edu.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;edu.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;_&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12275</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12275"/>
		<updated>2016-12-05T23:34:01Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.12.5&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Forgot to mention adding the special attributes in section ?&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12267</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12267"/>
		<updated>2016-10-25T18:05:35Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;_DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;_DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;_DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12266</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12266"/>
		<updated>2016-10-25T17:25:43Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Response Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#The DAP4 Serialized Representation (DSR)|6.2]]&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12265</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12265"/>
		<updated>2016-10-25T17:23:29Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Response Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.2]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#How the Chunked Encoding Affects the Data Response Format|6.1.3]])&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12264</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12264"/>
		<updated>2016-10-25T17:21:49Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Response Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Format Related DMR Attributes&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The DMR MAY contain attributes that reflect information from the serialized data.&lt;br /&gt;
Specifically, the following attributes are defined.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Checksum_CRC32&amp;quot; type=&amp;quot;Int32&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute may be attached to each top-level variable to show&lt;br /&gt;
the CRC-32 checksum of the content of that data. See Section&lt;br /&gt;
[[#How the Chunked Encoding Affects the Data Response Format|6.1.3]])&lt;br /&gt;
for more information.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;Attribute name=&amp;quot;_DAP4_Little_Endian&amp;quot; type=&amp;quot;UInt8&amp;quot;/&amp;gt; &amp;amp;mdash;&lt;br /&gt;
this attribute exists in the root group (the dataset) to indicate if&lt;br /&gt;
the serialized data byte order is little-endian. The value &amp;quot;1&amp;quot; indicates&lt;br /&gt;
that little-endian order was used and &amp;quot;0&amp;quot; indicates that big-endian order was used.&lt;br /&gt;
If missing, little-endian is assumed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12263</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12263"/>
		<updated>2016-10-25T17:03:03Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* The DAP4 Serialized Representation (DSR) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses. Note that the&lt;br /&gt;
value of the checksum will change depending on the byte order used&lt;br /&gt;
to serialize the data.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12262</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12262"/>
		<updated>2016-10-25T16:53:36Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.10.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add _DAP4_Little_Endian attribute to the DMR to reflect the bytorder used to encode the serialized data.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&lt;br /&gt;
:Temp: &#039;&#039;lat&#039;&#039; X &#039;&#039;lon&#039;&#039; -&amp;gt; Float32&lt;br /&gt;
:where&lt;br /&gt;
:&#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; subsets are of Float32 in the range [0,360).&lt;br /&gt;
&lt;br /&gt;
The range is, of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice,&#039; where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are DAP4 &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using Shared Dimensions for array slicing adds some complexity to the processing of constraints. Two cases are important to consider and are shown in the examples. &lt;br /&gt;
* When a request is made for an Array with Maps but the request names only the Array and not the Maps, the assumption is made that the requester intended to receive &#039;&#039;only&#039;&#039; the Array and not the Maps. For example, the client might have already requested/received the Maps. Note that in this case the CDMR included with the data response will still include the &#039;&#039;Map&#039;&#039; element(s) for the Array, and the receiving client must know that the associated (Map) variable is not present in the response. &lt;br /&gt;
* A second case involves requests for two or more Arrays that share Maps and that constrain (i.e. &#039;slice&#039;) those Maps differently. Because this can introduce a logical inconsistency, when a local dimension slice is applied to an Array&#039;s dimension that has a Map, using that local dimension slice will cause the Map to be removed from the data response&#039;s CDMR.&lt;br /&gt;
The examples make these two cases clearer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;New 4/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
; &#039;&#039;temp&#039;&#039;: This will return only the Array &#039;&#039;temp&#039;&#039;. The constraint &#039;&#039;lat;lon;temp&#039;&#039; will return three Arrays: The Map Arrays &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the &#039;value Array&#039; &#039;&#039; temp. In both cases the CDMR returned in the response will include mention of the Maps &#039;&#039;lat&#039; and &#039;&#039;lon&#039;&#039;. In the first case where only &#039;&#039;temp&#039;&#039; is requested, the client must be savvy (or permissive) enough to realize that the Map Arrays are not present. In summary, it is the requester&#039;s responsibility to understand that the Maps are separate variables and must be explicitly requested. Here are example CDMR responses:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CDMR for the CE &#039;&#039;lat;lon;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal[][8:9]&#039;&#039;: This request is almost the same as the third example, but notice that &#039;&#039;sal&#039;&#039; uses a local dimension slice for its second dimension. This means that it will not use the &#039;&#039;nlon=[10:19]&#039;&#039; slice that &#039;&#039;temp&#039;&#039; uses. To avoid a conflict with the &#039;&#039;nlon&#039;&#039; slice and the fact that that is being applied to &#039;&#039;temp&#039;&#039; (and &#039;&#039;lon&#039;&#039; in this example), applying a local dimension slice to an Array with Maps will cause the associated Maps to be elided from the response&#039;s CDMR. For Arrays with no Maps, this has no effect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The CDMR for the CE &#039;&#039;temp&#039;&#039;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- The effect of &#039;&#039;nlat=[0:9]&#039;&#039; --&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- ... nlon=[10:19] -&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;               &amp;lt;!-- We asked for lat and lon --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;              &amp;lt;!-- ... and temp --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;              &amp;lt;!-- ... and sal, but... --&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=2/&amp;gt;                   &amp;lt;!-- for this dimension, we use a local dim slice --&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;               &amp;lt;!-- and thus only one of the two Maps is shown. --&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;/New&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points3[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points4[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2{x; y; sounding | depth &amp;gt; 20} | x &amp;gt; 17&#039;&#039;: This show, without the added complexity of an array, how filter expressions associate with Sequences. For the sequence &#039;&#039;sounding&#039;&#039; the filter expression can use only &#039;&#039;depth&#039;&#039; and &#039;&#039;temp&#039;&#039; (and constants). When filtering the values of a child sequence, the sequence name must be used and thus the names of all of the fields of the parent sequence needed in the result must be listed.&lt;br /&gt;
; &#039;&#039;/Points3[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points3&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
; &#039;&#039;/Points4[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12167</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12167"/>
		<updated>2016-02-24T23:17:09Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;24 February 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rollback to version of 2015.12.16&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.&amp;lt;br&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, Enumerations, and AttributeSets. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to e.g. a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for Enumeration declarations.&lt;br /&gt;
&lt;br /&gt;
Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
Note that the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;pre&amp;gt;&#039;/environmental_data/places.weather.temperature&#039;.&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character &amp;amp;mdash; &amp;quot;.&amp;quot; instead of&lt;br /&gt;
&amp;quot;/&amp;quot; &amp;amp;mdash; once we enter the scope of a structure (or sequence).&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences. Enumerations cannot be nested.&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain in this order: dimension, enumerations, variables, and (sub-)groups. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values called enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 are problematic precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An Array is a multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple attributes are defined using the following XML scheme.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|EnumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, Enum fqn, etc.).&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more value declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access field &#039;&#039;x&#039;&#039; in &#039;&#039;Point&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/inst2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name, except that if a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and a slice of &#039;&#039;sounding&#039;&#039; where the &#039;&#039;sounding&#039;&#039; slice is every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable or attribute in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points3[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12166</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12166"/>
		<updated>2016-02-23T19:41:20Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Compound Typed Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, a set of slices is allowed, separated by commas. Acceptable slice formats include these.&lt;br /&gt;
; &#039;&#039;[ ]&#039;&#039; : return all of elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; &#039;&#039;[n]&#039;&#039; : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the single slice syntax.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Typed Variables ====&lt;br /&gt;
If the variable is of type Structure, then the variable&#039;s Structure type is included. The type will be modified to only include fields referenced in the constraint. The variable itself will, of course, be included in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12165</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12165"/>
		<updated>2016-02-23T19:40:28Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Structure Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, a set of slices is allowed, separated by commas. Acceptable slice formats include these.&lt;br /&gt;
; &#039;&#039;[ ]&#039;&#039; : return all of elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; &#039;&#039;[n]&#039;&#039; : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the single slice syntax.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Compound Typed Variables ====&lt;br /&gt;
If the variable is of type Structure or Sequence, then the variable&#039;s Structure or Sequence  type is included. The type will be modified to only include fields referenced in the constraint. The variable itself will, of course, be included in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12164</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12164"/>
		<updated>2016-02-23T19:33:45Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Array subsetting with Disjoint Index Subsets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, a set of slices is allowed, separated by commas. Acceptable slice formats include these.&lt;br /&gt;
; &#039;&#039;[ ]&#039;&#039; : return all of elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; &#039;&#039;[n]&#039;&#039; : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the single slice syntax.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of any of the previously defined slice formats (most generally &#039;&#039;start:stride:last&#039;&#039;). The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the event that the slices are not disjoint, the result is undefined.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12163</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12163"/>
		<updated>2016-02-23T19:30:27Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Array Subsetting in Index Space */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, a set of slices is allowed, separated by commas. Acceptable slice formats include these.&lt;br /&gt;
; &#039;&#039;[ ]&#039;&#039; : return all of elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; &#039;&#039;[n]&#039;&#039; : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the single slice syntax.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [&#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12162</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12162"/>
		<updated>2016-02-23T19:28:10Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Array Subsetting in Index Space */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, a set of slices is allowed, separated by commas. Acceptable slice formats include these.&lt;br /&gt;
; &#039;&#039;&amp;amp;lt;empty&amp;amp;gt;&#039;&#039; : return all of elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; &#039;&#039;n&#039;&#039; : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the single slice syntax.&lt;br /&gt;
; &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Subsetting can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12161</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12161"/>
		<updated>2016-02-23T19:19:02Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Example: subsetting by variable or field */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. Specificially.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12159</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12159"/>
		<updated>2016-02-21T05:46:08Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Reserved Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;^&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A (reverse) DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;^&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12158</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12158"/>
		<updated>2016-02-17T21:02:12Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;17 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.17&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify DMR-only and Data DMR response content.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12157</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12157"/>
		<updated>2016-02-17T21:00:01Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Response Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;16 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned. The DMR-Only response MUST be &#039;&#039;self-contained&#039;&#039;. This means that all declarations directly or transitively mentioned in the selected variables must be included in the returned DMR. Additionally, all attributes associated with the included declarations MUST be included as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. The response, however, MUST be self-contained (in the DMR-Only sense). DAP attributes for all included declarations MUST be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12156</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12156"/>
		<updated>2016-02-16T22:16:49Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;16 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite attribute section to clean it up and clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12155</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12155"/>
		<updated>2016-02-16T22:15:02Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Attributes and Arbitrary XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt; &amp;amp;lt;!--optional--&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomicTypeName|enumType fqn}&amp;quot; value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type: one of the defined atomic types such as Int16, String, etc., or the fqn of an enum type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; value as an alternate form for attributes with a single value,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; OR a set of contained attributes,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute containers may may only contain attributes. Container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12154</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12154"/>
		<updated>2016-02-16T21:56:40Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12153</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12153"/>
		<updated>2016-02-16T18:09:20Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Attributes and Arbitrary XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved attribute names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12152</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12152"/>
		<updated>2016-02-16T18:08:22Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Fully Qualified Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved attribute names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is this.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;li&amp;gt;Reserved names (see above) inherently contain characters (&#039;.&#039;) that will require escaping.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
====Reserved Attribute Names====&lt;br /&gt;
Any attribute name (including that of AttributeSets or OtherXML) that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence must be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of the form, for example, &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named attribute.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver of such an attribute has no information about how to process it, it may at its discretion either ignore the attribute or treat it as an ordinary attribute. &lt;br /&gt;
&lt;br /&gt;
If an attribute name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary attribute name.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12151</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12151"/>
		<updated>2016-02-16T18:03:26Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved attribute names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Reserved Names===&lt;br /&gt;
&lt;br /&gt;
Any name that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence should be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of this syntactic form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DNS = &amp;amp;lt;name&amp;amp;gt; | DNS &#039;.&#039; &amp;amp;lt;name&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An example might be &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named object.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver encounters such a name and has no information on how to process it, it may at its discretion either ignore the object with that name, or it may treat the name as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
If a name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary name.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
====Reserved Attribute Names====&lt;br /&gt;
Any attribute name (including that of AttributeSets or OtherXML) that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence must be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of the form, for example, &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named attribute.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver of such an attribute has no information about how to process it, it may at its discretion either ignore the attribute or treat it as an ordinary attribute. &lt;br /&gt;
&lt;br /&gt;
If an attribute name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary attribute name.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12150</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12150"/>
		<updated>2016-02-15T21:05:48Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;15 Feb 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Provide a general mechanism for arbitrary reserved attribute names.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
====Reserved Attribute Names====&lt;br /&gt;
Any attribute name (including that of AttributeSets or OtherXML) that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence must be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of the form, for example, &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named attribute.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver of such an attribute has no information about how to process it, it may at its discretion either ignore the attribute or treat it as an ordinary attribute. &lt;br /&gt;
&lt;br /&gt;
If an attribute name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary attribute name.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12149</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12149"/>
		<updated>2016-02-15T21:02:20Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Attributes and Arbitrary XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
====Reserved Attribute Names====&lt;br /&gt;
Any attribute name (including that of AttributeSets or OtherXML) that begins with the character sequence &amp;quot;&amp;amp;&amp;quot; is considered special. In particular, that sequence must be followed by a reverse DNS name defining both the definer of that reserved name and possible additional naming information.&lt;br /&gt;
&lt;br /&gt;
A DNS name is of the form, for example, &amp;quot;org.ucar.unidata.NAME1.NAME2...&amp;quot;. This indicates the owner/definer of that name is &amp;quot;org.ucar.unidata&amp;quot; and that the additional naming information (&amp;quot;NAME1.NAME2...) has meaning to the owner to define the semantics of the so-named attribute.&lt;br /&gt;
&lt;br /&gt;
Note that if the receiver of such an attribute has no information about how to process it, it may at its discretion either ignore the attribute or treat it as an ordinary attribute. &lt;br /&gt;
&lt;br /&gt;
If an attribute name starts with &amp;quot;&amp;amp;&amp;quot;, but is not followed by something that looks like a DNS name, then it is treated as an ordinary attribute name.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12148</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12148"/>
		<updated>2016-02-15T20:35:45Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Attributes and Arbitrary XML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dap4 supports an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup that provides a way for the protocol to transport information encoded in XML. This is useful for &amp;quot;annotating&amp;quot; meta-data with information more complex than simple attributes. This can be used, for example, for passing semantic web information, or for passing out-of-band information: e.g about the conversion from some other meta-data system into DAP4.&lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12134</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12134"/>
		<updated>2016-02-02T23:32:42Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;br&amp;gt;Add clarifying notes in the constraint description section.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12133</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12133"/>
		<updated>2016-02-02T23:30:29Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Example: subsetting by variable or field */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expressions to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:&lt;br /&gt;
* &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
* &#039;&#039;/Point{/Point_t.x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
* There are some important exceptions to the previous note. In the event that the a simple name is used and that name can be unambiguously determined then that is allowed. This has two specific cases.&lt;br /&gt;
** The name prefixed with &amp;quot;/&amp;quot; is legitmate, then it can be used and refers to the object at the top-group (i.e. dataset) level.&lt;br /&gt;
** If a simple name is referenced inside curly braces (e.g. {x}) for a variable whose type is a structure or sequence type, S say, and &amp;quot;x&amp;quot; is a top-level field in S, then that is allowed.&lt;br /&gt;
** In all other cases, an FQN must be used; this is subject to change as additional useful cases emerge.&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12132</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12132"/>
		<updated>2016-02-02T23:05:04Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Fully Qualified Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 several kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, Sequences, and enumerations. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a &amp;quot;top-level&amp;quot; variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. It must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;DE&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note that the FQN of field &amp;quot;temperature&amp;quot; (example dataset &amp;quot;D&amp;quot; above) is not affected by the fact that an instance of that structure is declared as the type of the variable &amp;quot;weather&amp;quot;; this is not true, however for constraints (see Section [[#Constraints|8]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12131</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12131"/>
		<updated>2016-02-02T22:24:41Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.02.01&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rewrite the FQN sections to clarify.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. Except as noted below, it must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nested types (e.g. a Structure reference in a structure follows in the same vein. Consider the following example which contains a Structure named &amp;quot;weather&amp;quot; of type &amp;quot;weather_t&amp;quot; within a Structure named &amp;quot;places&amp;quot; of type &amp;quot;places_t&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Sequence name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Int32 name=&amp;quot;time&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;UInt32 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Seq seq=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/places.weather.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note in the last example that the structure name &amp;quot;places_t&amp;quot; is not part of the FQN because it is directly implied by the type of the variable &amp;quot;places&amp;quot;. One could define a different FQN form that included it, but it would be redundant.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12130</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12130"/>
		<updated>2016-02-02T22:21:30Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Fully Qualified Names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences. Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]).&lt;br /&gt;
&lt;br /&gt;
The FQN for a variable &amp;amp;mdash; as opposed to a field in a structure or sequence &amp;amp;mdash;  is defined purely by the sequence of enclosing groups plus the variable&#039;s simple name. This also holds for type declarations (Enumerations, Sructures,  and Sequences). Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Int64 name=&amp;quot;population&amp;quot;/&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;Group name=&amp;quot;types&amp;quot;&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                 &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
             &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
         &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the variable named &amp;quot;population&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/demographic_data/population&amp;lt;/pre&amp;gt;&lt;br /&gt;
The FQN for the Structure type named &amp;quot;weather_t&amp;quot; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that in both cases, the name of the dataset (&amp;quot;D&amp;quot;) is not included; it is implied by the leading &amp;quot;/&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The FQN for a field of a structure or sequence is different. Except as noted below, it must reference the FQN of the enclosing sequence or structure. Again using the prior example, the FQN for the field &amp;quot;temperature&amp;quot; is&lt;br /&gt;
&amp;lt;pre&amp;gt;/environmental_data/types/weather_t.temperature&amp;lt;/pre&amp;gt;. Note the use of a different separator character dot (&amp;quot;.&amp;quot;) instead of &amp;quot;/&amp;quot; to indicate that &amp;quot;temperature is a field.&lt;br /&gt;
&lt;br /&gt;
Enumeration constants are treated similarly to fields. Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Enumeration name=&amp;quot;e&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;lt;EnumConst name=&amp;quot;v1&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the &amp;quot;v1&amp;quot; constant in &amp;quot;e&amp;quot; is as follows. &amp;lt;pre&amp;gt;/e.v1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nested types (e.g. a Structure reference in a structure follows in the same vein. Consider the following example which contains a Structure named &amp;quot;weather&amp;quot; of type &amp;quot;weather_t&amp;quot; within a Structure named &amp;quot;places&amp;quot; of type &amp;quot;places_t&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Sequence name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Int32 name=&amp;quot;time&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;UInt32 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Seq seq=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is as follows.&lt;br /&gt;
&amp;lt;pre&amp;gt;/places.weather.temperature&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;li&amp;gt; An FQN is not a value reference so dimensions or a particular Sequence index is not part of the FQN; the FQN is purely a way to unambiguously identify a syntactic element in a DMR.&lt;br /&gt;
&amp;lt;li&amp;gt;Note in the last example that the structure name &amp;quot;places_t&amp;quot; is not part of the FQN because it is directly implied by the type of the variable &amp;quot;places&amp;quot;. One could define a different FQN form that included it, but it would be redundant.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The characters &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12129</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12129"/>
		<updated>2016-01-30T23:38:21Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences . Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]). Consider the following simple dataset, which contains a Structure named &amp;quot;weather&amp;quot; of type &amp;quot;weather_t&amp;quot; within a Structure named &amp;quot;places&amp;quot; of type &amp;quot;places_t&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Sequence name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Seq seq=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/environmental_data/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several characters such as &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12128</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=12128"/>
		<updated>2016-01-30T23:36:37Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2016, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;30 Jan 2016&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2016 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2016.01.30&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add back the multiple disjoint slice subset.(dmh)&amp;lt;br&amp;gt;Move Structure and Sequence to be first class types like Enumeration (per discussion with jhg.(dmh)&amp;lt;br&amp;gt;Re-ordering of type discutions (atomic, enum, container).&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. Container types define a complex structure of &amp;quot;fields&amp;quot;. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences . Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]). Consider the following simple dataset, which contains a Structure named &amp;quot;weather&amp;quot; of type &amp;quot;weather_t&amp;quot; within a Structure named &amp;quot;places&amp;quot; of type &amp;quot;places_t&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Sequence name=&amp;quot;weather_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Seq seq=&amp;quot;weather_t&amp;quot; name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Struct struct=&amp;quot;places_t&amp;quot; name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/environmental_data/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several characters such as &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or type) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, Enumerations, Structures, and Sequences.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and types. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Container declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes. Note specifically that multi-byte character encodings such as UTF-8 cannot be used precisely because they can be multi-byte.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups an ordered list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including a container type.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence of zero or more instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;s_t&amp;quot; name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped that isolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Struct and Seq Types&amp;quot;&amp;gt;The Struct and Seq Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for referencing a container type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;FQN&amp;quot; ... &amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Struct and Seq types are intended to be used in the definition of a variable. It should not be confused with the definition of the corresponding Structure or Sequence type, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Struct typed variable requires an attribute that references a previously defined &amp;amp;lt;Structure&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;li&amp;gt; The Seq typed variable requires the an attribute that references a previously defined &amp;amp;lt;Sequence&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition of the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variables may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Struct and Seq typed variables MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimension&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Struct struct=&amp;quot;structtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structure variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Seq seq=&amp;quot;seqtype&amp;quot; name=&amp;quot;varname&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Seq&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequence variables MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types, but none of the container types,  are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;S_t&amp;quot; name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;a-star_t&amp;quot; name=&amp;quot;a-star&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Struct struct=&amp;quot;x-star_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Struct&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence type &#039;x-star_t&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;y-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star_t&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Seq seq=&amp;quot;y-star_t&amp;quot; name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Seq seq=&amp;quot;x-start_t&amp;quot; name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; }&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Struct /Point_t Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Struct /Point_t Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point_t&amp;quot;&amp;gt; &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt; &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt; &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Struct struct=&amp;quot;/Point_t&amp;quot; name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Struct&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Point_t { Int32 x; Int32 y; };&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Struct Point_t Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Structure sounding_t { Int32 height[1024]; Int32 pressure[1024];}&lt;br /&gt;
    Structure Points_t { Int32 x; Int32 y; Struct /sounding_t sounding; }&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Struct /Points_t Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence s1_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence s2_t { Int32 x; Int32 y; }&lt;br /&gt;
    Sequence s3_t { Int32 z; Int32 x[10];}&lt;br /&gt;
    Sequence s4_t { Int32 z; Int32 x[1024];}&lt;br /&gt;
&lt;br /&gt;
    Seq /s1_t s1;&lt;br /&gt;
    Seq /s2_t s2[100];&lt;br /&gt;
    Seq /s3_t s3;&lt;br /&gt;
    Seq /s4_t s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Structures, Sequences, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Container Types ====&lt;br /&gt;
A container type declaration is included in the CDMR if and only if some variable in the CE references it or some included container type references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence Points_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Seq /Points_t Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence sounding_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temp;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points1 {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence Points2 {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
	Seq /sounding_t sounding;&lt;br /&gt;
    }&lt;br /&gt;
    Sequence raw_t {&lt;br /&gt;
        Int32 depth;&lt;br /&gt;
        Int32 temps[4];&lt;br /&gt;
    }&lt;br /&gt;
    Structure Points3_t {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Seq raw_t raw;&lt;br /&gt;
    }&lt;br /&gt;
    Seq Points1_t Points1;&lt;br /&gt;
    Seq Points2_t Points2[20];&lt;br /&gt;
    Struct Points3_t Points3[100]&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structuredef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencedef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structuredef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencedef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structvariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;seqvariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Struct&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;struct&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;seqvariable&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Seq&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;seq&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody structuredef&lt;br /&gt;
	| groupbody sequencedef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structuredef:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencedef:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	containerbody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| containerbody dimref&lt;br /&gt;
	| containerbody variable&lt;br /&gt;
	| containerbody mapref&lt;br /&gt;
	| containerbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCT_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_STRUCT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQ_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_SEQ&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SEQ&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_STRUCT&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| SEQ_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| STRUCT_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _SEQ&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _STRUCT&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token STRUCT_ _STRUCT&lt;br /&gt;
%token SEQ_ _SEQ&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SEQ ATTR_SIZE ATTR_STRUCT ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12115</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12115"/>
		<updated>2016-01-16T22:07:22Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Function Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR&amp;lt;br /&amp;gt;  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/16&lt;br /&gt;
&#039;&#039;&#039;Revised&#039;&#039;&#039;: 1/16/16&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/1/16:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/16/16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Converted to totally functional form using an eval() function.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added comma as escaped character for function args.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations on the server with respect to one or more datasets. These computations include (and sometimes extend) the constraint computations associated with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an extended DAP4 constraint language. I will address my approach to Type 2 in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form: &amp;lt;pre&amp;gt;name=f(a1,...,an)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that using this form, we can jam statements together without (I think) any parsing ambiguity. I considered using a semicolon separator, but we already overload that character. Note also that first level parsing becomes trivial; if it were not&lt;br /&gt;
for the nested parentheses issue (see below) it would (I think) be regular.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Interesting. This idea is much more like a series of statements than the DAP2 (original) notion of a single function per query/access. This is effectively what we&#039;ve started doing - allowing for a sequence of &#039;statements.&#039; This idea takes that notion farther by binding names to the results, which is interesting but also means that the lookup table (environment) must be read/write. Not a huge deal, but something to consider.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Not sure what you mean by&lt;br /&gt;
&amp;quot;...lookup table (environment) must be read/write...&amp;quot;&lt;br /&gt;
For a given query, the number of names on the left hand side &lt;br /&gt;
is fixed for the query. Since this is single assignent, then once&lt;br /&gt;
assigned, the value associated with a name is fixed.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but I think that this makes the construction of meta-data (see below) harder. The price one pays is that one might have to convert the above to something like this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This implies that &#039;&#039;f()&#039;&#039; must be called repeatedly. This may be mitigated by having f() cache its results or by having &#039;&#039;f()&#039;&#039; return a structure.&lt;br /&gt;
&lt;br /&gt;
[N.B. In light of jhg comment, using a return structure seems to be the way to go.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We are using the &#039;structure return&#039; approach now and it works fairly well. There are, of course, some wrinkles, but on the whole it&#039;s a simple solution that works well with the existing software. jhrg 1/5/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Good to know. I will adopt.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
# It is (IMO) easier to read and write&lt;br /&gt;
# It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
&#039;&#039;x.y.z.f&#039;&#039;.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves. Certain function names such as&lt;br /&gt;
&#039;&#039;eval&#039;&#039; and &#039;&#039;return&#039;&#039; are reserved words. Note that this not&lt;br /&gt;
much of an issue since any one introducing their own &#039;&#039;eva&#039;&#039;&#039;, for example,&lt;br /&gt;
would presumably put it into some defined namespace (e.g. &#039;&#039;ns.eval&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables. The approach taken here is to assume that the arguments to an expression are separated by commas. Thus, the top-level query processor can parse the arguments to a function and detect which are the names of previously assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments as unevaluated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process. I propose that we use parentheses plus, where necessary,  the backslash (&#039;\&#039;) as the escaping mechanism. This means that any argument that is surrounded by parentheses is passed unchanged as a string argument to the function. Note that if the argument itself contains balanced parentheses, these will be parsed as matching pairs and passed along. The gotcha is that an unbalanced parenthesis must be escaped with a backslash.&lt;br /&gt;
&lt;br /&gt;
Similarly, commas and backslashes will need to be escaped so that the list of function arguments can be properly parsed. &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;[New]&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;re doing this. Again, it&#039;s not so bad. (sorry about the red, but it makes these comments easier to see)&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Are you using backslash escapes?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Evaluating DAP4 Basic Constraints ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;[New section]&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is convenient to allow for the use of DAP4 basic constraints. To this end,&lt;br /&gt;
we support an &#039;&#039;eval&#039;&#039; function that takes a single DAP4 basic constraint,&lt;br /&gt;
evaluates it, and returns it&#039;s value as the value of the &#039;&#039;eval&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the variables that will be returned to the client that made they original query. The simplest approach is to have a &amp;quot;return&amp;quot; statement of this form.&lt;br /&gt;
&amp;lt;pre&amp;gt;return(d1,d2,...dn)&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the di are the names to which expressions were previously assigned. One potential complication is with respect to DAP4 groups. It may be desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form: &#039;&#039;g1.g2...gn.di&#039;&#039; to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the expression is not evaluated. This is, of course, because the client can ask for the &#039;&#039;.dmr&#039;&#039; and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve tried this and it&#039;s OK when it works, but some functions&#039; results are needed to determine the metadata. We&#039;ve adopted the rule that it&#039;s easier to just have functions do their thing and cache the results - return only the DMR when that&#039;s the request but cache the full  data response.&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;The costs are of course that the full computation&lt;br /&gt;
may be enormous.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the return statement.  This means that we only need to obtain the meta-data for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data. For a function evaluation, we have no idea because it could be largely arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to describe the meta-data that will result from its execution with specific arguments. This means that when the client requests the &#039;&#039;dmr&#039;&#039;, the query must be evaluated as the meta-data level to obtain the final &#039;&#039;dmr&#039;&#039;.  If, later, the client asks for the &#039;&#039;.dap&#039;&#039; (the data), then the evaluation must produce data that conforms to the &#039;&#039;dmr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dmr&#039;&#039; construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
# Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
# If the statement is &amp;quot;name=(&amp;lt;DAP4 expression&amp;gt;)&amp;quot; then use the existing rules to meta-assign the DAP4 expression meta-data to the left side variable.&lt;br /&gt;
# Consider a function &amp;quot;f(a1,...,an)&amp;quot;, where some of the ai are references to previously defined variables. In this case, we invoke the functions&#039;s meta-evaluator with its variable references replaced with the corresponding meta-data for that variable.&lt;br /&gt;
# The final &#039;&#039;return&#039;&#039; statement returns the concatenation of the meta-data of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Structures&#039;&#039;&#039;: A function might return a structure, which is ok, but it might return a structure with different numbers of fields depending on its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
#&#039;&#039;&#039;Selections over dimensioned arrays&#039;&#039;&#039;: We discussed this a long time ago and decided to leave it out of the basic DAP4 constraint language. However here it is possible for a function to, for example, take an array as input and return another array as output, where the output is defined by the values of the input array.&lt;br /&gt;
:: The problem is that the actual dimensions might differ depending on the content of the input array. So, if the client asks for the &#039;&#039;dmr&#039;&#039; only, what dimension is returned? I am considering the following alternatives:&lt;br /&gt;
::#Encapsulate the output array as a sequence or (sometimes) a set of nested sequences [N.B. James, this is one reason I am considering the VLEN concept to replace sequences].&lt;br /&gt;
::#Introduce the netCDF concept of UNLIMITED dimensions to indicate that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
::I have not decided which way to go on this. I lean towards the Sequence solution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve written a function that builds a table from a set of arrays (that meet other constraints) and use Sequence as the return type internally, transforming the result to whatever elsewhere as needed. &amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Can you elaborate on this?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some [http://www.iges.org/grads/gds/doc/user.html GrADS &#039;_expr_&#039; examples] to the form proposed here. I failed because GrADS uses a full-blown scripting language, so it was not possible to emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
#Should this proposal be folded into dap.ce (i.e. the existing basic constraint language) or as a separate constraint system dap.fcn, say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve done the latter&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12114</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12114"/>
		<updated>2016-01-16T22:06:13Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR&amp;lt;br /&amp;gt;  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/16&lt;br /&gt;
&#039;&#039;&#039;Revised&#039;&#039;&#039;: 1/16/16&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/1/16:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/16/16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Converted to totally functional form using an eval() function.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added comma as escaped character for function args.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations on the server with respect to one or more datasets. These computations include (and sometimes extend) the constraint computations associated with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an extended DAP4 constraint language. I will address my approach to Type 2 in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form: &amp;lt;pre&amp;gt;name=f(a1,...,an)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that using this form, we can jam statements together without (I think) any parsing ambiguity. I considered using a semicolon separator, but we already overload that character. Note also that first level parsing becomes trivial; if it were not&lt;br /&gt;
for the nested parentheses issue (see below) it would (I think) be regular.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Interesting. This idea is much more like a series of statements than the DAP2 (original) notion of a single function per query/access. This is effectively what we&#039;ve started doing - allowing for a sequence of &#039;statements.&#039; This idea takes that notion farther by binding names to the results, which is interesting but also means that the lookup table (environment) must be read/write. Not a huge deal, but something to consider.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Not sure what you mean by&lt;br /&gt;
&amp;quot;...lookup table (environment) must be read/write...&amp;quot;&lt;br /&gt;
For a given query, the number of names on the left hand side &lt;br /&gt;
is fixed for the query. Since this is single assignent, then once&lt;br /&gt;
assigned, the value associated with a name is fixed.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but I think that this makes the construction of meta-data (see below) harder. The price one pays is that one might have to convert the above to something like this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This implies that &#039;&#039;f()&#039;&#039; must be called repeatedly. This may be mitigated by having f() cache its results or by having &#039;&#039;f()&#039;&#039; return a structure.&lt;br /&gt;
&lt;br /&gt;
[N.B. In light of jhg comment, using a return structure seems to be the way to go.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We are using the &#039;structure return&#039; approach now and it works fairly well. There are, of course, some wrinkles, but on the whole it&#039;s a simple solution that works well with the existing software. jhrg 1/5/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Good to know. I will adopt.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
# It is (IMO) easier to read and write&lt;br /&gt;
# It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
&#039;&#039;x.y.z.f&#039;&#039;.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves. Certain function names such as&lt;br /&gt;
&#039;&#039;eval&#039;&#039; and &#039;&#039;return&#039;&#039; are reserved words. Note that this not&lt;br /&gt;
much of an issue since any one introducing their own &#039;&#039;eva&#039;&#039;&#039;, for example,&lt;br /&gt;
would presumably put it into some defined namespace (e.g. &#039;&#039;ns.eval&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables. The approach taken here is to assume that the arguments to an expression are separated by commas. Thus, the top-level query processor can parse the arguments to a function and detect which are the names of previously assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments as unevaluated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process. I propose that we use parentheses plus, where necessary,  the backslash (&#039;\&#039;) as the escaping mechanism. This means that any argument that is surrounded by parentheses is passed unchanged as a string argument to the function. Note that if the argument itself contains balanced parentheses, these will be parsed as matching pairs and passed along. The gotcha is that an unbalanced parenthesis must be escaped with a backslash.&lt;br /&gt;
&lt;br /&gt;
Similarly, commas will need to be escaped so that the list of function arguments can be properly parsed. &amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;[New]&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;re doing this. Again, it&#039;s not so bad. (sorry about the red, but it makes these comments easier to see)&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Are you using backslash escapes?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Evaluating DAP4 Basic Constraints ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;[New section]&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is convenient to allow for the use of DAP4 basic constraints. To this end,&lt;br /&gt;
we support an &#039;&#039;eval&#039;&#039; function that takes a single DAP4 basic constraint,&lt;br /&gt;
evaluates it, and returns it&#039;s value as the value of the &#039;&#039;eval&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the variables that will be returned to the client that made they original query. The simplest approach is to have a &amp;quot;return&amp;quot; statement of this form.&lt;br /&gt;
&amp;lt;pre&amp;gt;return(d1,d2,...dn)&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the di are the names to which expressions were previously assigned. One potential complication is with respect to DAP4 groups. It may be desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form: &#039;&#039;g1.g2...gn.di&#039;&#039; to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the expression is not evaluated. This is, of course, because the client can ask for the &#039;&#039;.dmr&#039;&#039; and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve tried this and it&#039;s OK when it works, but some functions&#039; results are needed to determine the metadata. We&#039;ve adopted the rule that it&#039;s easier to just have functions do their thing and cache the results - return only the DMR when that&#039;s the request but cache the full  data response.&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;The costs are of course that the full computation&lt;br /&gt;
may be enormous.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the return statement.  This means that we only need to obtain the meta-data for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data. For a function evaluation, we have no idea because it could be largely arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to describe the meta-data that will result from its execution with specific arguments. This means that when the client requests the &#039;&#039;dmr&#039;&#039;, the query must be evaluated as the meta-data level to obtain the final &#039;&#039;dmr&#039;&#039;.  If, later, the client asks for the &#039;&#039;.dap&#039;&#039; (the data), then the evaluation must produce data that conforms to the &#039;&#039;dmr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dmr&#039;&#039; construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
# Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
# If the statement is &amp;quot;name=(&amp;lt;DAP4 expression&amp;gt;)&amp;quot; then use the existing rules to meta-assign the DAP4 expression meta-data to the left side variable.&lt;br /&gt;
# Consider a function &amp;quot;f(a1,...,an)&amp;quot;, where some of the ai are references to previously defined variables. In this case, we invoke the functions&#039;s meta-evaluator with its variable references replaced with the corresponding meta-data for that variable.&lt;br /&gt;
# The final &#039;&#039;return&#039;&#039; statement returns the concatenation of the meta-data of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Structures&#039;&#039;&#039;: A function might return a structure, which is ok, but it might return a structure with different numbers of fields depending on its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
#&#039;&#039;&#039;Selections over dimensioned arrays&#039;&#039;&#039;: We discussed this a long time ago and decided to leave it out of the basic DAP4 constraint language. However here it is possible for a function to, for example, take an array as input and return another array as output, where the output is defined by the values of the input array.&lt;br /&gt;
:: The problem is that the actual dimensions might differ depending on the content of the input array. So, if the client asks for the &#039;&#039;dmr&#039;&#039; only, what dimension is returned? I am considering the following alternatives:&lt;br /&gt;
::#Encapsulate the output array as a sequence or (sometimes) a set of nested sequences [N.B. James, this is one reason I am considering the VLEN concept to replace sequences].&lt;br /&gt;
::#Introduce the netCDF concept of UNLIMITED dimensions to indicate that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
::I have not decided which way to go on this. I lean towards the Sequence solution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve written a function that builds a table from a set of arrays (that meet other constraints) and use Sequence as the return type internally, transforming the result to whatever elsewhere as needed. &amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Can you elaborate on this?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some [http://www.iges.org/grads/gds/doc/user.html GrADS &#039;_expr_&#039; examples] to the form proposed here. I failed because GrADS uses a full-blown scripting language, so it was not possible to emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
#Should this proposal be folded into dap.ce (i.e. the existing basic constraint language) or as a separate constraint system dap.fcn, say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve done the latter&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12113</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12113"/>
		<updated>2016-01-16T21:49:46Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR&amp;lt;br /&amp;gt;  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/16&lt;br /&gt;
&#039;&#039;&#039;Revised&#039;&#039;&#039;: 1/16/16&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/1/16:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;1/16/16&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Converted to totally functional form using an eval() function.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations on the server with respect to one or more datasets. These computations include (and sometimes extend) the constraint computations associated with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an extended DAP4 constraint language. I will address my approach to Type 2 in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form: &amp;lt;pre&amp;gt;name=f(a1,...,an)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that using this form, we can jam statements together without (I think) any parsing ambiguity. I considered using a semicolon separator, but we already overload that character. Note also that first level parsing becomes trivial; if it were not&lt;br /&gt;
for the nested parentheses issue (see below) it would (I think) be regular.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Interesting. This idea is much more like a series of statements than the DAP2 (original) notion of a single function per query/access. This is effectively what we&#039;ve started doing - allowing for a sequence of &#039;statements.&#039; This idea takes that notion farther by binding names to the results, which is interesting but also means that the lookup table (environment) must be read/write. Not a huge deal, but something to consider.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Not sure what you mean by&lt;br /&gt;
&amp;quot;...lookup table (environment) must be read/write...&amp;quot;&lt;br /&gt;
For a given query, the number of names on the left hand side &lt;br /&gt;
is fixed for the query. Since this is single assignent, then once&lt;br /&gt;
assigned, the value associated with a name is fixed.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but I think that this makes the construction of meta-data (see below) harder. The price one pays is that one might have to convert the above to something like this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This implies that &#039;&#039;f()&#039;&#039; must be called repeatedly. This may be mitigated by having f() cache its results or by having &#039;&#039;f()&#039;&#039; return a structure.&lt;br /&gt;
&lt;br /&gt;
[N.B. In light of jhg comment, using a return structure seems to be the way to go.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We are using the &#039;structure return&#039; approach now and it works fairly well. There are, of course, some wrinkles, but on the whole it&#039;s a simple solution that works well with the existing software. jhrg 1/5/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Good to know. I will adopt.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
# It is (IMO) easier to read and write&lt;br /&gt;
# It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
&#039;&#039;x.y.z.f&#039;&#039;.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves. Certain function names such as&lt;br /&gt;
&#039;&#039;eval&#039;&#039; and &#039;&#039;return&#039;&#039; are reserved words. Note that this not&lt;br /&gt;
much of an issue since any one introducing their own &#039;&#039;eva&#039;&#039;&#039;, for example,&lt;br /&gt;
would presumably put it into some defined namespace (e.g. &#039;&#039;ns.eval&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables. The approach taken here is to assume that the arguments to an expression are separated by commas. Thus, the top-level query processor can parse the arguments to a function and detect which are the names of previously assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments as unevalated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process. I propose that we use parentheses plus, where necessary,  the backslash (&#039;\&#039;) as the escaping mechanism. This means that any argument that is surrounded by parentheses is passed unchanged as a string argument to the function. Note that if the argument itself contains balanced parentheses, these will be parsed as matching pairs and passed along. The gotcha is that an unbalanced parenthesis must be escaped witha backslash.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;re doing this. Again, it&#039;s not so bad. (sorry about the red, but it makes these comments easier to see)&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Are you using backslash escapes?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Evaluating DAP4 Basic Constraints ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;[New section]&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is convenient to allow for the use of DAP4 basic constraints. To this end,&lt;br /&gt;
we support an &#039;&#039;eval&#039;&#039; function that takes a single DAP4 basic constraint,&lt;br /&gt;
evaluates it, and returns it&#039;s value as the value of the &#039;&#039;eval&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the variables that will be returned to the client that made they original query. The simplest approach is to have a &amp;quot;return&amp;quot; statement of this form.&lt;br /&gt;
&amp;lt;pre&amp;gt;return(d1,d2,...dn)&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the di are the names to which expressions were previously assigned. One potential complication is with respect to DAP4 groups. It may be desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form: &#039;&#039;g1.g2...gn.di&#039;&#039; to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the expression is not evaluated. This is, of course, because the client can ask for the &#039;&#039;.dmr&#039;&#039; and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve tried this and it&#039;s OK when it works, but some functions&#039; results are needed to determine the metadata. We&#039;ve adopted the rule that it&#039;s easier to just have functions do their thing and cache the results - return only the DMR when that&#039;s the request but cache the full  data response.&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;The costs are of course that the full computation&lt;br /&gt;
may be enormous.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the return statement.  This means that we only need to obtain the meta-data for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data. For a function evaluation, we have no idea because it could be largely arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to describe the meta-data that will result from its execution with specific arguments. This means that when the client requests the &#039;&#039;dmr&#039;&#039;, the query must be evaluated as the meta-data level to obtain the final &#039;&#039;dmr&#039;&#039;.  If, later, the client asks for the &#039;&#039;.dap&#039;&#039; (the data), then the evaluation must produce data that conforms to the &#039;&#039;dmr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dmr&#039;&#039; construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
# Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
# If the statement is &amp;quot;name=(&amp;lt;DAP4 expression&amp;gt;)&amp;quot; then use the existing rules to meta-assign the DAP4 expression meta-data to the left side variable.&lt;br /&gt;
# Consider a function &amp;quot;f(a1,...,an)&amp;quot;, where some of the ai are references to previously defined variables. In this case, we invoke the functions&#039;s meta-evaluator with its variable references replaced with the corresponding meta-data for that variable.&lt;br /&gt;
# The final &#039;&#039;return&#039;&#039; statement returns the concatenation of the meta-data of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Structures&#039;&#039;&#039;: A function might return a structure, which is ok, but it might return a structure with different numbers of fields depending on its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
#&#039;&#039;&#039;Selections over dimensioned arrays&#039;&#039;&#039;: We discussed this a long time ago and decided to leave it out of the basic DAP4 constraint language. However here it is possible for a function to, for example, take an array as input and return another array as output, where the output is defined by the values of the input array.&lt;br /&gt;
:: The problem is that the actual dimensions might differ depending on the content of the input array. So, if the client asks for the &#039;&#039;dmr&#039;&#039; only, what dimension is returned? I am considering the following alternatives:&lt;br /&gt;
::#Encapsulate the output array as a sequence or (sometimes) a set of nested sequences [N.B. James, this is one reason I am considering the VLEN concept to replace sequences].&lt;br /&gt;
::#Introduce the netCDF concept of UNLIMITED dimensions to indicate that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
::I have not decided which way to go on this. I lean towards the Sequence solution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve written a function that builds a table from a set of arrays (that meet other constraints) and use Sequence as the return type internally, transforming the result to whatever elsewhere as needed. &amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Can you elaborate on this?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some [http://www.iges.org/grads/gds/doc/user.html GrADS &#039;_expr_&#039; examples] to the form proposed here. I failed because GrADS uses a full-blown scripting language, so it was not possible to emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
#Should this proposal be folded into dap.ce (i.e. the existing basic constraint language) or as a separate constraint system dap.fcn, say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve done the latter&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12112</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12112"/>
		<updated>2016-01-15T22:03:13Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR&amp;lt;br /&amp;gt;  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/31&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations on the server with respect to one or more datasets. These computations include (and sometimes extend) the constraint computations associated with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an extended DAP4 constraint language. I will address my approach to Type 2 in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;name=(&amp;lt;DAP4constraint&amp;gt;)&lt;br /&gt;
or&lt;br /&gt;
name=f(a1...an)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that by using parentheses, we can jam statements together without (I think) any parsing ambiguity. I considered using a semicolon separator, but we already overload that character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Interesting. This idea is much more like a series of statements than the DAP2 (original) notion of a sing function per query/access. This is effectively what we&#039;ve started doing - allowing for a sequence of &#039;statements.&#039; This idea takes that notion farther by binding names to the results, which is interesting but also means that the lookup table (environment) must be read/write. Not a huge deal, but something to consider.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Not sure what you mean by&lt;br /&gt;
&amp;quot;...lookup table (environment) must be read/write...&amp;quot;&lt;br /&gt;
For a given query, the number of names on the left hand side &lt;br /&gt;
is fixed for the query. Since this is single assignent, then once&lt;br /&gt;
assigned, the value associated with a name is fixed.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but I think that this makes the construction of meta-data (see below) harder. The price one pays is that one might have to convert the above to something like this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This implies that &#039;&#039;f()&#039;&#039; must be called repeatedly. This may be mitigated by havinf f() cache its results or by having &#039;&#039;f()&#039;&#039; return a structure.&lt;br /&gt;
&lt;br /&gt;
I need to think on this some more.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We are using the &#039;structure return&#039; approach now and it works fairly well. There are, of course, some wrinkles, but on the whole it&#039;s a simple solution that works well with the existing software. jhrg 1/5/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Good to know.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
# It is (IMO) easier to read and write&lt;br /&gt;
# It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
&#039;&#039;x.y.z.f&#039;&#039;.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves.&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables. The approach taken here is to assume that the arguments to an expression are separated by commas. Thus, the top-level query processor can parse the arguments to a function and detect which are the names of previously assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments as unevalated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process. I propose that we use parentheses plus, where necessary,  the backslash (&#039;\&#039;) as the escaping mechanism. This means that any argument that is surrounded by parentheses is passed unchanged as a string argument to the function. Note that if the argument itself contains balanced parentheses, these will be parsed as matching pairs and passed along. The gotcha is that an unbalanced parenthesis must be escaped witha backslash.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;re doing this. Again, it&#039;s not so bad. (sorry about the red, but it makes these comments easier to see)&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Are you using backslash escapes?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the variables that will be returned to the client that made they original query. The simplest approach is to have a &amp;quot;return&amp;quot; statement of this form.&lt;br /&gt;
&amp;lt;pre&amp;gt;return(d1,d2,...dn)&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the di are the names to which expressions were previously assigned. One potential complication is with respect to DAP4 groups. It may be desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form: &#039;&#039;g1.g2...gn.di&#039;&#039; to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the expression is not evaluated. This is, of course, because the client can ask for the &#039;&#039;.dmr&#039;&#039; and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve tried this and it&#039;s OK when it works, but some functions&#039; results are needed to determine the metadata. We&#039;ve adopted the rule that it&#039;s easier to just have functions do their thing and cache the results - return only the DMR when that&#039;s the request but cache the full  data response.&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;The costs are of course that the full computation&lt;br /&gt;
may be enormous.&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the return statement.  This means that we only need to obtain the meta-data for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data. For a function evaluation, we have no idea because it could be largely arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to describe the meta-data that will result from its execution with specific arguments. This means that when the client requests the &#039;&#039;dmr&#039;&#039;, the query must be evaluated as the meta-data level to obtain the final &#039;&#039;dmr&#039;&#039;.  If, later, the client asks for the &#039;&#039;.dap&#039;&#039; (the data), then the evaluation must produce data that conforms to the &#039;&#039;dmr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dmr&#039;&#039; construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
# Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
# If the statement is &amp;quot;name=(&amp;lt;DAP4 expression&amp;gt;)&amp;quot; then use the existing rules to meta-assign the DAP4 expression meta-data to the left side variable.&lt;br /&gt;
# Consider a function &amp;quot;f(a1,...,an)&amp;quot;, where some of the ai are references to previously defined variables. In this case, we invoke the functions&#039;s meta-evaluator with its variable references replaced with the corresponding meta-data for that variable.&lt;br /&gt;
# The final &#039;&#039;return&#039;&#039; statement returns the concatenation of the meta-data of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Structures&#039;&#039;&#039;: A function might return a structure, which is ok, but it might return a structure with different numbers of fields depending on its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
#&#039;&#039;&#039;Selections over dimensioned arrays&#039;&#039;&#039;: We discussed this a long time ago and decided to leave it out of the basic DAP4 constraint language. However here it is possible for a function to, for example, take an array as input and return another array as output, where the output is defined by the values of the input array.&lt;br /&gt;
:: The problem is that the actual dimensions might differ depending on the content of the input array. So, if the client asks for the &#039;&#039;dmr&#039;&#039; only, what dimension is returned? I am considering the following alternatives:&lt;br /&gt;
::#Encapsulate the output array as a sequence or (sometimes) a set of nested sequences [N.B. James, this is one reason I am considering the VLEN concept to replace sequences].&lt;br /&gt;
::#Introduce the netCDF concept of UNLIMITED dimensions to indicate that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
::I have not decided which way to go on this. I lean towards the Sequence solution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve written a function that builds a table from a set of arrays (that meet other constraints) and use Sequence as the return type internally, transforming the result to whatever elsewhere as needed. &amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;blue&amp;quot;&amp;gt;Can you elaborate on this?&lt;br /&gt;
dmh 1/15/16&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some [http://www.iges.org/grads/gds/doc/user.html GrADS &#039;_expr_&#039; examples] to the form proposed here. I failed because GrADS uses a full-blown scripting language, so it was not possible to emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
#Should this proposal be folded into dap.ce (i.e. the existing basic constraint language) or as a separate constraint system dap.fcn, say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;We&#039;ve done the latter&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12100</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12100"/>
		<updated>2016-01-04T18:47:11Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner&amp;lt;br /&amp;gt; &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR&amp;lt;br /&amp;gt;  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/31&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations on the server with respect to one or more datasets. These computations include (and sometimes extend) the constraint computations associated with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an extended DAP4 constraint language. I will address my approach to Type 2 in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;name=(&amp;lt;DAP4constraint&amp;gt;)&lt;br /&gt;
or&lt;br /&gt;
name=f(a1...an)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that by using parentheses, we can jam statements together without (I think) any parsing ambiguity. I considered using a semicolon separator, but we already overload that character.&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
but I think that this makes the construction of meta-data (see below) harder. The price one pays is that one might have to convert the above to something like this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This implies that &#039;&#039;f()&#039;&#039; must be called repeatedly. This may be mitigated by havinf f() cache its results or by having &#039;&#039;f()&#039;&#039; return a structure.&lt;br /&gt;
&lt;br /&gt;
I need to think on this some more.&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
# It is (IMO) easier to read and write&lt;br /&gt;
# It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
&#039;&#039;x.y.z.f&#039;&#039;.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves.&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables. The approach taken here is to assume that the arguments to an expression are separated by commas. Thus, the top-level query processor can parse the arguments to a function and detect which are the names of previously assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments as unevalated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process. I propose that we use parentheses plus, where necessary,  the backslash (&#039;\&#039;) as the escaping mechanism. This means that any argument that is surrounded by parentheses is passed unchanged as a string argument to the function. Note that if the argument itself contains balanced parentheses, these will be parsed as matching pairs and passed along. The gotcha is that an unbalanced parenthesis must be escaped witha backslash.&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the variables that will be returned to the client that made they original query. The simplest approach is to have a &amp;quot;return&amp;quot; statement of this form.&lt;br /&gt;
&amp;lt;pre&amp;gt;return(d1,d2,...dn)&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the di are the names to which expressions were previously assigned. One potential complication is with respect to DAP4 groups. It may be desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form: &#039;&#039;g1.g2...gn.di&#039;&#039; to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the expression is not evaluated. This is, of course, because the client can ask for the &#039;&#039;.dmr&#039;&#039; and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the return statement.  This means that we only need to obtain the meta-data for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data. For a function evaluation, we have no idea because it could be largely arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to describe the meta-data that will result from its execution with specific arguments. This means that when the client requests the &#039;&#039;dmr&#039;&#039;, the query must be evaluated as the meta-data level to obtain the final &#039;&#039;dmr&#039;&#039;.  If, later, the client asks for the &#039;&#039;.dap&#039;&#039; (the data), then the evaluation must produce data that conforms to the &#039;&#039;dmr&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dmr&#039;&#039; construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
# Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
# If the statement is &amp;quot;name=(&amp;lt;DAP4 expression&amp;gt;)&amp;quot; then use the existing rules to meta-assign the DAP4 expression meta-data to the left side variable.&lt;br /&gt;
# Consider a function &amp;quot;f(a1,...,an)&amp;quot;, where some of the ai are references to previously defined variables. In this case, we invoke the functions&#039;s meta-evaluator with its variable references replaced with the corresponding meta-data for that variable.&lt;br /&gt;
# The final &#039;&#039;return&#039;&#039; statement returns the concatenation of the meta-data of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
#&#039;&#039;&#039;Structures&#039;&#039;&#039;: A function might return a structure, which is ok, but it might return a structure with different numbers of fields depending on its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
#&#039;&#039;&#039;Selections over dimensioned arrays&#039;&#039;&#039;: We discussed this a long time ago and decided to leave it out of the basic DAP4 constraint language. However here it is possible for a function to, for example, take an array as input and return another array as output, where the output is defined by the values of the input array.&lt;br /&gt;
:: The problem is that the actual dimensions might differ depending on the content of the input array. So, if the client asks for the &#039;&#039;dmr&#039;&#039; only, what dimension is returned? I am considering the following alternatives:&lt;br /&gt;
::#Encapsulate the output array as a sequence or (sometimes) a set of nested sequences [N.B. James, this is one reason I am considering the VLEN concept to replace sequences].&lt;br /&gt;
::#Introduce the netCDF concept of UNLIMITED dimensions to indicate that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
::I have not decided which way to go on this. I lean towards the Sequence solution.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some [http://www.iges.org/grads/gds/doc/user.html GrADS &#039;_expr_&#039; examples] to the form proposed here. I failed because GrADS uses a full-blown scripting language, so it was not possible to emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
#Should this proposal be folded into dap.ce (i.e. the existing basic constraint language) or as a separate constraint system dap.fcn, say.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12099</id>
		<title>DAP4: Type 1 Server Side Functions</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Type_1_Server_Side_Functions&amp;diff=12099"/>
		<updated>2016-01-04T18:10:53Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: Created page with &amp;quot;== Proposal for DAP4 Server-Side Functions == &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Dennis Heimbigner  &amp;#039;&amp;#039;&amp;#039;Organization&amp;#039;&amp;#039;&amp;#039;: Unidata/UCAR   &amp;#039;&amp;#039;&amp;#039;Initial Draft&amp;#039;&amp;#039;&amp;#039;: 1/1/31  The server-side function (SSF) p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal for DAP4 Server-Side Functions ==&lt;br /&gt;
&#039;&#039;&#039;Author&#039;&#039;&#039;: Dennis Heimbigner &lt;br /&gt;
&#039;&#039;&#039;Organization&#039;&#039;&#039;: Unidata/UCAR  &lt;br /&gt;
&#039;&#039;&#039;Initial Draft&#039;&#039;&#039;: 1/1/31&lt;br /&gt;
&lt;br /&gt;
The server-side function (SSF) problem divides&lt;br /&gt;
into two parts.&lt;br /&gt;
&lt;br /&gt;
* Type 1: There are limited set of functions that do &amp;quot;simple&amp;quot; computations&lt;br /&gt;
   on the server with respect to one or more datasets. These computations&lt;br /&gt;
   include (and sometimes extend) the constraint computations associated&lt;br /&gt;
   with (e.g. DAP4) queries.&lt;br /&gt;
&lt;br /&gt;
* Type 2: There are much larger, longer-duration, computations that do&lt;br /&gt;
   significant computing over one or more datasets.&lt;br /&gt;
&lt;br /&gt;
This proposal addresses Type 1 functions for use within an&lt;br /&gt;
extended DAP4 constraint language. I will address my approach to Type 2&lt;br /&gt;
in a subsequent document.&lt;br /&gt;
&lt;br /&gt;
=== General Syntax ===&lt;br /&gt;
The key element of this proposal is to use single assignment&lt;br /&gt;
syntax and semantics.&lt;br /&gt;
&lt;br /&gt;
* A query consists of a sequence of assignment statements&lt;br /&gt;
optionally separated by blanks.&lt;br /&gt;
&lt;br /&gt;
* The basic assignment statement is of the form:&lt;br /&gt;
````&lt;br /&gt;
name=(&amp;lt;DAP4constraint&amp;gt;)&lt;br /&gt;
or&lt;br /&gt;
name=f(a1...an)&lt;br /&gt;
````&lt;br /&gt;
Notes that by using parentheses, we can jam statements together without&lt;br /&gt;
(I think) any parsing ambiguity. I considered using a semicolon separator,&lt;br /&gt;
but we already overload that character.&lt;br /&gt;
&lt;br /&gt;
I considered the possibility of allowing a function to return multiple&lt;br /&gt;
values, like this&lt;br /&gt;
````&lt;br /&gt;
name,...name=f(...)&lt;br /&gt;
````&lt;br /&gt;
but I think that this makes the construction of meta-data (see below)&lt;br /&gt;
harder. The price one pays is that one might have to convert the above&lt;br /&gt;
to something like this.&lt;br /&gt;
````&lt;br /&gt;
name1=f(1,...)&lt;br /&gt;
...&lt;br /&gt;
namen=f(n,...)&lt;br /&gt;
````&lt;br /&gt;
This implies that f() must be called repeatedly.&lt;br /&gt;
This may be mitigated by havinf f() cache its results&lt;br /&gt;
or by having f() return a structure.&lt;br /&gt;
&lt;br /&gt;
I need to think on this some more.&lt;br /&gt;
&lt;br /&gt;
=== Single Assignment Rule ===&lt;br /&gt;
Any &amp;quot;assignment&amp;quot; is unique in that no other statement may assign to this&lt;br /&gt;
same variable; this is why it is called &amp;quot;single assignment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It is convenient for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
1. It is (IMO) easier to read and write&lt;br /&gt;
2. It unwinds nested expressions, hence simplifying the syntax.&lt;br /&gt;
&lt;br /&gt;
=== Function Syntax ===&lt;br /&gt;
A function call is of the usual form&lt;br /&gt;
````&lt;br /&gt;
f(a1,a2,...,an)&lt;br /&gt;
````&lt;br /&gt;
It is intended that function namespaces be supported,&lt;br /&gt;
so the function name, f, may actually be of the form&lt;br /&gt;
`x.y.z.f`.&lt;br /&gt;
The assumption is that the server maintains a namespace&lt;br /&gt;
tree with functions as leaves.&lt;br /&gt;
&lt;br /&gt;
The arguments (a1,...,an) present a problem. It is unlikely that&lt;br /&gt;
we can syntactically prescribe the form of arguments because they&lt;br /&gt;
are specific to the function.  For those familiar with lisp, they&lt;br /&gt;
need to act like FEXPRs.&lt;br /&gt;
&lt;br /&gt;
Because of the need to construct meta-data (see below), it must be&lt;br /&gt;
possible to detect which arguments refer to previously defined variables.&lt;br /&gt;
The approach taken here is to assume that the arguments to an expression&lt;br /&gt;
are separated by commas. Thus, the top-level query processor can parse&lt;br /&gt;
the arguments to a function and detect which are the names of previously&lt;br /&gt;
assigned variables.&lt;br /&gt;
&lt;br /&gt;
In addition, there must be some way to pass other kinds of arbitrary arguments&lt;br /&gt;
as unevalated strings to the function.&lt;br /&gt;
For other arguments, including simple names that might be mistaken for&lt;br /&gt;
variables, we need some kind of escape process.&lt;br /&gt;
I propose that we use parentheses plus, where necessary, &lt;br /&gt;
the backslash (&#039;\\&#039;) as the escaping mechanism.&lt;br /&gt;
This means that any argument that is surrounded by parentheses&lt;br /&gt;
is passed unchanged as a string argument to the function.&lt;br /&gt;
Note that if the argument itself contains balanced parentheses,&lt;br /&gt;
these will be parsed as matching pairs and passed along.&lt;br /&gt;
The gotcha is that an unbalanced parenthesis must be escaped with&lt;br /&gt;
a backslach.&lt;br /&gt;
&lt;br /&gt;
=== Returning Variables ===&lt;br /&gt;
At the end of our query, it will be necessary to specify the&lt;br /&gt;
variables that will be returned to the client that made they original&lt;br /&gt;
query. The simplest approach is to have a &amp;quot;return&amp;quot; statement&lt;br /&gt;
of this form.&lt;br /&gt;
````&lt;br /&gt;
return(d1,d2,...dn)&lt;br /&gt;
````&lt;br /&gt;
where the di are the names to which expressions were previously assigned.&lt;br /&gt;
One potential complication is with respect to DAP4 groups. It may be&lt;br /&gt;
desirable to insert any of the resulting variables in a specific&lt;br /&gt;
DAP4 group.  To this end, I propose to all the di to actually take this form:&lt;br /&gt;
`g1.g2...gn.di` to indicate the group position of each variable.&lt;br /&gt;
&lt;br /&gt;
=== Meta-data for Queries ===&lt;br /&gt;
For DAP4, every query is associated with a meta-data&lt;br /&gt;
description that describes the structure of the returned data.&lt;br /&gt;
&lt;br /&gt;
This is the really hard part of this proposal, and everything else&lt;br /&gt;
must be designed to support meta-data construction.&lt;br /&gt;
&lt;br /&gt;
Note that meta-data construction will be needed even if the&lt;br /&gt;
expression is not evaluated. This is, of course, because the&lt;br /&gt;
client can ask for the *.dmr* and that will return only the meta-data.&lt;br /&gt;
&lt;br /&gt;
As a minor point, note that the result(s) of a query are defined by the&lt;br /&gt;
return statement.  This means that we only need to obtain the meta-data&lt;br /&gt;
for the expressions that defined the variables in the return statement.&lt;br /&gt;
&lt;br /&gt;
For DAP4 basic constraints, we already know how to construct the meta-data.&lt;br /&gt;
For a function evaluation, we have no idea because it could be largely&lt;br /&gt;
arbitrary.&lt;br /&gt;
&lt;br /&gt;
The approach taken here is to require every function to be able to&lt;br /&gt;
describe the meta-data that will result from its execution with specific&lt;br /&gt;
arguments. This means that when the client requests the *dmr*, the query&lt;br /&gt;
must be evaluated as the meta-data level to obtain the final *dmr*.  If,&lt;br /&gt;
later, the client asks for the *.dap* (the data), then the evaluation&lt;br /&gt;
must produce data that conforms to the *dmr*.&lt;br /&gt;
&lt;br /&gt;
The *dmr* construction process is likely to look like this.&lt;br /&gt;
&lt;br /&gt;
1. Meta-evaluate each statement in the query from left to right.&lt;br /&gt;
2. If the statement is `name=(&amp;lt;DAP4 expression&amp;gt;) then use&lt;br /&gt;
   the existing rules to meta-assign the DAP4 expression meta-data&lt;br /&gt;
   to the left side variable.&lt;br /&gt;
3. Consider a function `f(a1,...,an)`, where some of the ai&lt;br /&gt;
   are references to previously defined variables. In this case,&lt;br /&gt;
   we invoke the functions&#039;s meta-evaluator with its variable&lt;br /&gt;
   references replaced with the corresponding meta-data for that&lt;br /&gt;
   variable.&lt;br /&gt;
4. The final *return* returns the concatenation of the meta-data&lt;br /&gt;
   of the specified variables.&lt;br /&gt;
&lt;br /&gt;
There are some issues that need addressing.&lt;br /&gt;
&lt;br /&gt;
1. Structures&lt;br /&gt;
A function might return a structure, which is ok, but it&lt;br /&gt;
might return a structure with different numbers of fields depending on&lt;br /&gt;
its actual inputs. This is not ok and I propose to prohibit it.&lt;br /&gt;
&lt;br /&gt;
2. Selections over dimensioned arrays&lt;br /&gt;
We discussed this a long time ago and decided to leave it out of the&lt;br /&gt;
basic DAP4 constraint language. However here it is possible for a&lt;br /&gt;
function to, for example, take an array as input and return another&lt;br /&gt;
array as output, where the output is defined by the values of the input&lt;br /&gt;
array.&lt;br /&gt;
&lt;br /&gt;
The problem, as with, structure, is that the actual dimensions might differ&lt;br /&gt;
depending on the content of the input array. So, if the client asks for&lt;br /&gt;
the *dmr* only, what dimension is returned.&lt;br /&gt;
I am considering the following alternatives:&lt;br /&gt;
&lt;br /&gt;
1. Encapsulate the output array as a sequence or (sometimes) a set of&lt;br /&gt;
   nested sequences [N.B. James, this is one reason I am considering the&lt;br /&gt;
   VLEN concept to replace sequences].&lt;br /&gt;
&lt;br /&gt;
2. Introduce the netCDF concept of UNLIMITED dimensions to indicate&lt;br /&gt;
   that the actual size is unknown, but it is some fixed value.&lt;br /&gt;
&lt;br /&gt;
I have not decided which way to go on this. I lean towards the Sequence&lt;br /&gt;
solution.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
I propose to allow functions to annotate their meta-data&lt;br /&gt;
with whatever attributes they desire.&lt;br /&gt;
&lt;br /&gt;
=== GrADS Examples ===&lt;br /&gt;
Mostly out of curiosity, I attempted to convert some&lt;br /&gt;
[GrADS &#039;_expr_&#039; examples](http://www.iges.org/grads/gds/doc/user.html)&lt;br /&gt;
to the form proposed here. I failed because GrADS&lt;br /&gt;
uses a full-blown scripting language, so it was not possible to&lt;br /&gt;
emulate the given examples.&lt;br /&gt;
&lt;br /&gt;
=== Additional Open Issues ===&lt;br /&gt;
1. Should this proposal be folded into dap.ce&lt;br /&gt;
   (i.e. the existing basic constraint language)&lt;br /&gt;
   or as a separate constraint system dap.fcn, say.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=OPULS_Development&amp;diff=12098</id>
		<title>OPULS Development</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=OPULS_Development&amp;diff=12098"/>
		<updated>2016-01-04T17:53:27Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Data model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OPULS Process ==&lt;br /&gt;
[[DAP4: Design Proposal Process| Design Proposal Process]]&lt;br /&gt;
&lt;br /&gt;
Short version: Each proposal is in one of the following categories:&lt;br /&gt;
* New;&lt;br /&gt;
* Under Consideration;&lt;br /&gt;
* Accepted; &lt;br /&gt;
* Declined;&lt;br /&gt;
* Under Revision; or&lt;br /&gt;
* Obsolete&lt;br /&gt;
&lt;br /&gt;
== DAP4 Specification ==&lt;br /&gt;
&lt;br /&gt;
This section is deprecated in favor of the top-level [[DAP4 Specification |DAP4 Specification page]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- DO NOT EDIT this page without editing the main DAP4 Specification page.&lt;br /&gt;
     (But this page doesn&#039;t need to match the main page wrt intro/overview paragraphs.)&lt;br /&gt;
 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The draft specification has two volumes.&lt;br /&gt;
# [[DAP4: Overview | Overview: New Features Introduced in DAP4]]&lt;br /&gt;
# [[DAP4: Specification Volume 1 | Volume 1: Data Model, Persistent Representation, and Constraints]]&lt;br /&gt;
#* [[DAP4: Specification Volume 1 Deltas]]&lt;br /&gt;
# [[DAP4: Specification Volume 2 | Volume 2: Web Services Specification]]&lt;br /&gt;
# [[DAP4: Specification Volume 3 | Volume 3: DAP4 Extensions]]&lt;br /&gt;
# DAP4 Extensions&lt;br /&gt;
#* [[DAP4 Extension: CSV Data Encoding and Response]]&lt;br /&gt;
#* [[DAP4 Extension: NetCDF Data Response]]&lt;br /&gt;
#* [[DAP4 Extension: Asynchronous Response]]&lt;br /&gt;
#* [[DAP4 Extension: JSON Data and Metadata Encoding]]&lt;br /&gt;
&lt;br /&gt;
== DAP Use Cases ==&lt;br /&gt;
As part of the DAP2 --&amp;gt; DAP4 transition process, we are soliciting &#039;&#039;use cases regarding DAP client application development&#039;&#039; from the community. If you&#039;d like to submit a use case, you can send it to any of the OPULS developers (e.g., [mailto:jgallagher@openadp.org James Gallagher]) or the [mailto:opendap-tech@opendap.org OPeNDAP technical discussion list]. If you&#039;d like you use case to be anonymous, that&#039;s fine, just let us know.&lt;br /&gt;
&lt;br /&gt;
We will use these use cases to spot likely problems that may be encountered by members of the community who have developed specific client applications that interact with DAP servers.&lt;br /&gt;
&lt;br /&gt;
=== Use cases from GSFC ===&lt;br /&gt;
These use cases were submitted by Chris Lynnes:&lt;br /&gt;
&lt;br /&gt;
;Use Case #1:  Spatial/Variable Subsetter.  Our Simple Subset Wizard (SSW) works by constructing URLs to download spatial / variable subsets from the server as netCDF files (http://disc.gsfc.nasa.gov/SSW). This has allowed us to stop writing custom subsetter programs for each dataset or group of datasets.&lt;br /&gt;
&lt;br /&gt;
;Use Case #2:  Giovanni (http://giovanni.gsfc.nasa.gov/giovanni/) provides data exploration capabilities for datasets from GES DISC as well as a few select other providers. Data are acquired from servers via OPeNDAP, saved as netCDF/CF1, which is the Giovanni internal standard.  This allows the deployment of many netCDF-capable tools for analysis and data manipulation purposes.&lt;br /&gt;
&lt;br /&gt;
;Use Case #3:  MapServer provides WMS services for GES DISC data. Rather than site individual instances on each data server, we use the .vrt (Virtual files) capability in MapServer to set up the OPeNDAP connections needed to acquire data for the MapServer.&lt;br /&gt;
&lt;br /&gt;
;Use Case #4:  We are currently experimenting with the NcML aggregation capability to see if it is feasible to offer the ability to generate time series at a point using just Hyrax and the NcML handler.&lt;br /&gt;
&lt;br /&gt;
== DAP4 Features Straw man ==&lt;br /&gt;
This is a straw man design, broken down into sections. It is incomplete and its content is subject to revision. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;This was our foil; don&#039;t use it.&amp;lt;/font&amp;gt; The two documents about under &#039;DAP Specification&#039; are the current state of the DAP4 specification.&lt;br /&gt;
 &lt;br /&gt;
#&amp;lt;del&amp;gt; [[DAP4: DAP Versions | Versions]]&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP4: Checksum | Checksum]]&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP Service Terminus]]&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP4: Data Model | Data Model]] and a [http://scm.opendap.org/trac/browser/trunk/xml/dap/dap4.xsd XML Schema] that provides one representation for the data model.&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP4: Requests | Requests ]]&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP4: Responses | Responses]]&amp;lt;/del&amp;gt;&lt;br /&gt;
# &amp;lt;del&amp;gt; [[DAP4_Web_Services_-_StartingPoint | Web Services (Starting Point)]]&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposals ==&lt;br /&gt;
&lt;br /&gt;
===Data model ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; width=&amp;quot;85%&amp;quot;&lt;br /&gt;
|+ DAP4 Data Model Proposals&lt;br /&gt;
! Proposal&lt;br /&gt;
! Status&lt;br /&gt;
! Author&lt;br /&gt;
! Date Proposed&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Grids Proposal | Grids Ideas]] &lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039; &lt;br /&gt;
| Dennis, et al. &lt;br /&gt;
| (Cleaned up  4/10/2012)&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 XML| XML Use in DAP4]]&lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039; &lt;br /&gt;
| Dennis &lt;br /&gt;
| 2/25/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Top Level Group | Top Level Group]]&lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/12/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Proposal for Keys in Sequences| Proposal for Supporting Keys in Sequences]]&lt;br /&gt;
| &#039;&#039;&#039;Revised&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 5/28/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Constraints and Shared Dimensions | Constraints and Shared Dimensions]] &lt;br /&gt;
| &#039;&#039;&#039;Under Consideration&#039;&#039;&#039;, &#039;&#039;closely related to [[DAP4: DAP4 Grids Proposal | Grids Ideas]]&#039;&#039;&lt;br /&gt;
| James &amp;amp; Dennis&lt;br /&gt;
|  Modified 04/12/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: VLens (and Sequences)|Ideas for Defining VLens (and Sequences)]]  &lt;br /&gt;
| &#039;&#039;&#039;Under Consideration&#039;&#039;&#039;&lt;br /&gt;
| Dennis &lt;br /&gt;
| 02/25/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Paths| Path Specification in DAP4]] &lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 3/30/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Coordinate Systems Element| Coordinate Systems Element]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/10/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Nested Attributes | Nested Attributes]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/12/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Subsetting Arrays and Grids By Value| Subsetting Arrays and Grids By Value]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Nathan&lt;br /&gt;
| 4/27/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Proposal for a Constraint Notation| Proposal for a Constraint Notation]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/30/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Proposal for an abstract Constraint specification| Proposal for an Abstract Constraint Specification]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| James, ed.&lt;br /&gt;
| 5/22/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Proposal for Structure Projection| Proposal for Structure Projection]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 5/1/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Grids Ideas (Old Version) | Old Version of Grids Proposal]] &lt;br /&gt;
| &#039;&#039;&#039;Obsolete&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/10/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Filter Constraints| Filter Constraints]] &lt;br /&gt;
| &#039;&#039;&#039;new&#039;&#039;&#039;&lt;br /&gt;
| Dennis, John, Ethan&lt;br /&gt;
| 9/17/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Constraint Expressions| Constraint Expressions]] &lt;br /&gt;
| &#039;&#039;&#039;new&#039;&#039;&#039;&lt;br /&gt;
| Everyone; original note by Dennis, ed. by James&lt;br /&gt;
| 10/29/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Projection Syntax| DAP4 Projection Syntax]]&lt;br /&gt;
| &#039;&#039;&#039;withdrawn&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 2/8/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Checksum Changes| Proposed Changes to Checksumming]]&lt;br /&gt;
| &#039;&#039;&#039;accepted with modifications 3/19/2013&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 3/1/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: VLEN proposal| Proposal for new VLEN representation]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 7/21/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Constraint Expressions, v2| Proposal for a Comprehensive Constraint Expression Syntax]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| James, Dennis, et al.&lt;br /&gt;
| 7/29/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Alternate Proposal for a Constraint Expression Syntax| Alternate Proposal for a Constraint Expression Syntax]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 10/16/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Type 1 Server Side Functions| Type 1 Server Side Functions Proposal]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 1/4/16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Responses Specific to DAP4 ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; width=&amp;quot;85%&amp;quot;&lt;br /&gt;
|+ Persistent Representation&lt;br /&gt;
! Proposal&lt;br /&gt;
! Status&lt;br /&gt;
! Author&lt;br /&gt;
! Date Proposed&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4 Error Response| Error Response]]&lt;br /&gt;
|  &#039;&#039;&#039;new&#039;&#039;&#039;&lt;br /&gt;
| Nathan&lt;br /&gt;
| 11/19/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Using Multi-part Mime| Proposal to use Multi-part Mime]]&lt;br /&gt;
| &#039;&#039;&#039;new 3/19/2013&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 3/1/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Inclusion of response metadata in the DMR]]&lt;br /&gt;
| &#039;&#039;&#039;New&#039;&#039;&#039;&lt;br /&gt;
| James&lt;br /&gt;
| 7/23/2013&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DDX Grammar | DAP4 DDX Grammar]] &lt;br /&gt;
| &#039;&#039;&#039;Under Consideration&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DDX Lexical Elements]] &lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 2/28/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Escapes| Character Escape Mechanisms in DAP4]] &lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039;&lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/5/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Encoding for the Data Response]] &lt;br /&gt;
|&#039;&#039;&#039;Accepted&#039;&#039;&#039; &lt;br /&gt;
| James, based on [[DAP4: DAP4 On the Wire Format | Proposed DAP4 On-The-Wire Format]]  by Dennis&lt;br /&gt;
| 6/5/2012, updated 8/31/12&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Chunked encoding]] &lt;br /&gt;
|&#039;&#039;&#039;Accepted&#039;&#039;&#039; &lt;br /&gt;
| James&lt;br /&gt;
| 6/8/2012, updated 8/31/12&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 On the Wire Format | Proposed DAP4 On-The-Wire Format]] &lt;br /&gt;
|&#039;&#039;&#039;Obsolete&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/8/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Multipart Mime Format | Proposed Multipart Mime Format]] &lt;br /&gt;
|&#039;&#039;&#039;Obsolete&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 4/8/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Error Responses | Proposed Error Response Format]] &lt;br /&gt;
|&#039;&#039;&#039;Obsolete&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 5/8/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: DAP4 Replacing Chunking | Proposal to Replace Chunking ]] &lt;br /&gt;
|&#039;&#039;&#039;Obsolete&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| 8/23/2012&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Web &amp;amp; HTTP ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; width=&amp;quot;85%&amp;quot;&lt;br /&gt;
|+ Web Service Proposals&lt;br /&gt;
! Proposal&lt;br /&gt;
! Status&lt;br /&gt;
! Author&lt;br /&gt;
! Date Proposed&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Constraint and Query | DAP4 Constraint expressions and query strings.]]&lt;br /&gt;
| &#039;&#039;&#039;Under Consideration&#039;&#039;&#039;&lt;br /&gt;
| Nathan Potter&lt;br /&gt;
| 09/24/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Possible Notation for Server Commands | Possible Notation for Server Commands]] &lt;br /&gt;
|&#039;&#039;&#039;New&#039;&#039;&#039; &lt;br /&gt;
| Dennis&lt;br /&gt;
| Modified 04/12/2012&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4: Asynchronous Request-Response Proposal v3 | DAP4 Asynchronous Request-Response Proposal (new new version)]]&lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039;&lt;br /&gt;
| Ethan Davis and Nathan Potter and James Gallagher&lt;br /&gt;
| 6/15/2012; updated 1 Aug 2012&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;del&amp;gt;[[DAP4 Web Services v3 | DAP4 Web Services Proposal version 3]]&amp;lt;/del&amp;gt;&amp;lt;ins&amp;gt;[[DAP4: Specification Volume 2 | Volume 2: Web Services Specification]]&amp;lt;/ins&amp;gt;&lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039;&lt;br /&gt;
| Nathan Potter&lt;br /&gt;
| 6/18/2012&lt;br /&gt;
|-&lt;br /&gt;
| [[DAP4 Dataset Services Response ]]&lt;br /&gt;
| &#039;&#039;&#039;Accepted&#039;&#039;&#039;&lt;br /&gt;
| Nathan Potter&lt;br /&gt;
| 6/19/2012&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
| &amp;lt;hr/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;del&amp;gt;[[DAP4: Asynchronous Responses | Asynchronous Responses]] &amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;&#039;&#039;&#039;Obsolete&#039;&#039;&#039;&amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;Nathan&amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;4/5/2012&amp;lt;/del&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;del&amp;gt; [[DAP4: Asynchronous Request-Response Proposal | DAP4 Asynchronous Request-Response Proposal]]&amp;lt;/del&amp;gt;&lt;br /&gt;
|&amp;lt;del&amp;gt; &#039;&#039;&#039;Obsolete&#039;&#039;&#039;&amp;lt;/del&amp;gt;&lt;br /&gt;
|&amp;lt;del&amp;gt; EthanDavis&amp;lt;/del&amp;gt;&lt;br /&gt;
|&amp;lt;del&amp;gt; 4/10/2012&amp;lt;/del&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;del&amp;gt;[[DAP4: Capabilities and Versioning | DAP4 Capabilities and Versioning]]&amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;&#039;&#039;&#039;Obsolete&#039;&#039;&#039;&amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;EthanDavis&amp;lt;/del&amp;gt;&lt;br /&gt;
| &amp;lt;del&amp;gt;4/10/2012&amp;lt;/del&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
DAP4_Web_Services&lt;br /&gt;
These proposals have been put forth by Dennis ([[User:Jimg|Jimg]] 15:18, 27 March 2012 (PDT) Ordered by priority at the 3/27/12 meeting):&lt;br /&gt;
# [[DAP4: Constraints and Shared Dimensions | Constraints and Shared Dimensions]]  &#039;&#039;&#039;Under Review&#039;&#039;&#039;, &#039;&#039;closely related to [[DAP4: DAP4 Grids Proposal | Grids Ideas]]&#039;&#039; (New 02/26/2012)&lt;br /&gt;
# [[DAP4: VLens (and Sequences)|Ideas for Defining VLens (and Sequences)]]  &#039;&#039;&#039;Under Consideration&#039;&#039;&#039; (New 02/25/2012)&lt;br /&gt;
# [[DAP4: DAP4 Paths| Path Specification in DAP4]] &#039;&#039;&#039;New&#039;&#039;&#039; (New 3/30/2012)&lt;br /&gt;
# [[DAP4: DAP4 Escapes| Character Escape Mechanisms in DAP4]] &#039;&#039;&#039;New&#039;&#039;&#039; (Modified 4/5/2012)&lt;br /&gt;
# [[DAP4: Asynchronous Responses | Asynchronous Responses]] &#039;&#039;&#039;New&#039;&#039;&#039; (New 4/5/2012)&lt;br /&gt;
# [[DAP4: Coordinate Systems Element| Coordinate Systems Element]] &#039;&#039;&#039;New&#039;&#039;&#039; (New 4/10/2012)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Commentary on DAP4 Related Topics ==&lt;br /&gt;
These are not intended as specific proposal, but rather&lt;br /&gt;
as commentary on some issues with DAP4 that need addressing&lt;br /&gt;
with specific proposals.&lt;br /&gt;
# [[DAP4: URL Annotations | Characterization of URL Annotations]] (Modified: 2/26/2012)&lt;br /&gt;
# [[DAP4: Constructing a DDX from a Query | Constructing a DDX from a Query]] (new: 04/12/2012)&lt;br /&gt;
# [[DAP4: Notes on Constraints | Notes on Constraints]] (new: 04/29/2012)&lt;br /&gt;
# [[DAP4: An Essay on Domain Specific Models]] (new: 05/05/2012)&lt;br /&gt;
&lt;br /&gt;
== OPULS Implementation Thoughts ==&lt;br /&gt;
=== Unidata&#039;s Current Thoughts ===&lt;br /&gt;
&lt;br /&gt;
Unidata needs:&lt;br /&gt;
&lt;br /&gt;
  1) DAP4 C client library for use in netCDF-C library&lt;br /&gt;
  2) DAP4 Java client library for use in netCDF-Java library&lt;br /&gt;
  3) DAP4 Java server library for use in TDS&lt;br /&gt;
  4) Conformance test service against which a DAP4 client library can&lt;br /&gt;
     be tested&lt;br /&gt;
  5) Conformance test service against which a DAP4 server can be&lt;br /&gt;
     tested&lt;br /&gt;
&lt;br /&gt;
The current CDM and TDS use of opendap-java library has performance&lt;br /&gt;
problems due to extra API layers and extra copying of data. We would&lt;br /&gt;
prefer direct serialization between CDM objects and the DAP&lt;br /&gt;
on-the-wire data and would recommend that the OPeNDAP Java library&lt;br /&gt;
leverage the netCDF-Java libraries.&lt;br /&gt;
&lt;br /&gt;
If there are needs that the DAP4 opendap-java library be independent&lt;br /&gt;
of the netCDF-Java library, then in order for CDM and TDS to use the&lt;br /&gt;
opendap-java library, we would need the performance concerns mentioned&lt;br /&gt;
above addressed. A reasonable metric would be within some percentage&lt;br /&gt;
of cdmremote[1], say within 20-25%.&lt;br /&gt;
&lt;br /&gt;
Unidata&#039;s performance requirements for Java libraries:&lt;br /&gt;
&lt;br /&gt;
  1) The netCDF-Java library performance reading DAP4 through the DAP4&lt;br /&gt;
     Java client library must perform within 20-25% of cdmremote [1].&lt;br /&gt;
  2) TDS performance when handling DAP4 requests using the DAP4 Java&lt;br /&gt;
     server library should perform within 20-25% of cdmremote [1].&lt;br /&gt;
&lt;br /&gt;
We believe this means that the DAP4 Java libraries must provide a&lt;br /&gt;
sufficiently generic API that can be used directly with the CDM/TDS&lt;br /&gt;
IOSP interface.&lt;br /&gt;
&lt;br /&gt;
Unidata will:&lt;br /&gt;
  1) Write the DAP4 C client library.&lt;br /&gt;
  2) ??? some part of Java server library&lt;br /&gt;
  3) ??? some parts of conformance testing services&lt;br /&gt;
&lt;br /&gt;
NOTES:&lt;br /&gt;
&lt;br /&gt;
[1] cdmremote is an experimental CDM streaming service. It is basically&lt;br /&gt;
a direct serialization of the CDM.&lt;br /&gt;
== OPULS references ==&lt;br /&gt;
* http://www.mnot.net/blog/2011/10/25/web_api_versioning_smackdown&lt;br /&gt;
&lt;br /&gt;
== Old DAP4 Design and Implementation ==&lt;br /&gt;
* [[DAP3/4]]&lt;br /&gt;
* [[DAP 4.0 Design]] and [[DAP 4.0 Essential Features]] The &#039;&#039;design&#039;&#039; is meant to be a complete document while &#039;&#039;essential features&#039;&#039; are the minimal see we want to release. Since this task has been stalled for nearly a year, doing the latter seems like a noble goal.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=10561</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=10561"/>
		<updated>2014-07-13T02:24:41Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Constraints */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2012, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;04 July 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2013 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences . Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]). Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/environmental_data/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several characters such as &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and enumerations. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped thatisolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most (but not all) types may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimensions&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequences MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences.&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable.&lt;br /&gt;
&amp;lt;!-- Elide until implementation is complete * Multiple, disjoint index subsets.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Elide until implementation is complete&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points3[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=10560</id>
		<title>DAP4: Specification Volume 1</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_1&amp;diff=10560"/>
		<updated>2014-07-13T02:22:48Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: /* Array subsetting with Disjoint Index Subsets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&lt;br /&gt;
&amp;lt;!-- Copyright 2012, UCAR/Unidata --&amp;gt;&lt;br /&gt;
&amp;lt;!-- See the COPYRIGHT file for more information. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- When inserting text, AVOID the following situations: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * multiple occurrences of &amp;lt;a href=...&amp;gt; on a single line. --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * &amp;lt;a ...&amp;gt; and the closing &amp;lt;/a&amp;gt; on different lines. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 1: Data Model and Serialized Representation&#039;&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;May 31, 2012&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;04 July 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2013 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;This document defines the Data Access Protocol (DAP) version&lt;br /&gt;
4.0 (referred to also as DAP4). This data transmission&lt;br /&gt;
protocol is intended to supersede all previous versions of&lt;br /&gt;
the DAP protocol. DAP4 is designed specifically for science&lt;br /&gt;
data, but it is intended to be discipline neutral.&lt;br /&gt;
The protocol relies on widely used and stable&lt;br /&gt;
standards, and is capable of representing a wide variety of&lt;br /&gt;
scientific data types.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
This document takes material from the DAP2 specification and&lt;br /&gt;
the OPULS Wiki page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.24:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.27&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification of chunk order&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added specification and interpretation of simple queries&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.28&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion about nested sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.05.29&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Formatting changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.05&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed serialized representation sections and constraint sections until James provides direction.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Merge all changes from Gallagher, Potter, and Caron, except as noted.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all references to Sequences.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted James&#039; version of serialized representation.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added DMR RELAX-NG Grammar.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.24&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added (semi-)formal description of the DAP4 serialization scheme.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.6.26&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added: (1) Revised Char type (2) Revised unlimited dimension rules (3) revised MAP rules. (4) Removed HTTP references&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.09&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of identifier&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added discussion of XML escaping&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.10&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Fix discrepancies between the formal definition of the on-th-wire format and the examples.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.7.12&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed UByte and made Byte == UInt8&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.21&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added draft constraints section&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.8.25&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Improved the discussion of named slices in constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Minor change to the grammar for simple constraints.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.9.6&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Updated the Data Response section so that it no longer mentions Multipart MIME; edited the sections on FQNs and Attributes. I&#039;ve added nested attributes&#039; back into the text. I also added Sequence&#039; in several places where we will need it once we&#039;ve worked out how those are to be handled. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.1&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Integrate Jame&#039;s changes with recent changes&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.9&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Rebuild the .docx because of repeated Word crashes; minor formatting info changed/lost.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2012.11.23&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Add a Dataset construct to make the root group concept clear syntactically.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.3.8&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Made unlimited into a boolean attribute because it does have a size.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.7&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Inserted the new checksum description.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Removed all mention of unlimited wrt Dimensions&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Remove the base and ns attributes from &amp;amp;lt;Dataset&amp;amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.4.15&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Introduce &amp;amp;lt;Sequence&amp;amp;gt; as a replacement for variable length dimensions; The term &#039;&#039;Sequence&#039;&#039; is subject to future change. &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Clarify the maximum number of elements as a function of the maximum&lt;br /&gt;
        number of bytes.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.10.14&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Enforce a specific order on declarations in a Group body.&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Added sections for DSR, Async, and Error responses and their schemas&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.11.22&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Specified the case sensitivity of XML element names and XML attribute names&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Make a pass to clean up and clarify (dmh)&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This specification defines the protocol referred to as the Data Access Protocol, version 4.0 (&amp;quot;DAP4&amp;quot;).  In this document &#039;DAP&#039; refers to DAP4 unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
DAP is intended to be the successor to all previous versions of the DAP (specifically DAP version 2.0). The goal is to provide a very general data model capable of representing a wide variety of existing data sets.&lt;br /&gt;
&lt;br /&gt;
The DAP builds upon a number of existing data representation schemes. Specifically, it is influenced by&lt;br /&gt;
CDM&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-1|1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, HDF5 &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-2|2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, DAP version 2.0&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-3|3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;, and netCDF-4&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-5|5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The DAP is a protocol for access to data organized as variables. It is particularly suited to accesses by a client computer to data stored on remote (server) computers that are networked to the client computer.  DAP was designed to hide the implementation of different collections of data. The assumption is that a wide variety of data sets using a wide variety of data schemas can be translated into the DAP protocol for transmission from the server holding that dataset to a client computer for processing.&lt;br /&gt;
&lt;br /&gt;
It is important to stress the discipline neutrality of the DAP and the relationship between this and adoption of the DAP in disciplines other than the Earth sciences. Because the DAP is agnostic as relates to discipline, it can be used across the very broad range of data types encountered in oceanography - biological, chemical, physical and geological. There is nothing that constrains the use of the DAP to the Earth sciences. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
The key words &amp;quot;MUST&amp;quot;, &amp;quot;MUST NOT&amp;quot;, &amp;quot;REQUIRED&amp;quot;, &amp;quot;SHALL&amp;quot;, &amp;quot;SHALL NOT&amp;quot;, &amp;quot;SHOULD&amp;quot;, &amp;quot;SHOULD NOT&amp;quot;, &amp;quot;RECOMMENDED&amp;quot;, &amp;quot;MAY&amp;quot; and &amp;quot;OPTIONAL&amp;quot; in this document are to be interpreted as described in &amp;lt;nowiki&amp;gt;RFC 2119&amp;lt;/nowiki&amp;gt;. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#Ref-7|7]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall Operation==&lt;br /&gt;
&lt;br /&gt;
The DAP is a stateless protocol that governs clients making requests from servers, and servers issuing responses to those requests. This section provides an overview of the requests and responses (i.e. the messages) that DAP-compliant software MUST support. These messages are used to request information about a server and data made accessible by that server, as well as requesting data values themselves.&lt;br /&gt;
&lt;br /&gt;
For every data resource the DAP defines a number of responses that may elicited by a client. These responses provide services information (i.e. capabilities), structural/semantic descriptions, data access timing  and error information.&lt;br /&gt;
&lt;br /&gt;
The Dataset Services Response (DSR) provides a &#039;Services&#039; or &#039;Capabilities&#039; response for the DAP. Dereferencing an unadorned DAP dataset resource URL will return a document describing the DAP services available for the dataset.&lt;br /&gt;
&lt;br /&gt;
The DAP utilizes two responses to represent semantic structural description and data content of a data source.  One response, called the DMR, returns metadata information describing the structure of a request for data. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response, returns both the metadata about the request, but also the data that was requested. The DMR and the metadata part of the Data Response are represented using a specific XML [16] representation. The syntax of that representation is defined elsewhere in this document (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
 &lt;br /&gt;
The DAP returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The two responses (DMR and Data Response) are complete in and of themselves so that, for example, a client can use the data response without ever requesting either of the two other responses. In many cases, client programs will request the DMR response first before requesting the Data Response but there is no requirement they do so and no server SHALL require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
Operationally, communication between a DAP client and a DAP server uses some underlying already existing protocol, most typically HTTP. Volume 2 of this specification discusses how the DAP should utilize HTTP.&lt;br /&gt;
&lt;br /&gt;
In addition to these data objects, a DAP server MAY provide additional &amp;quot;services&amp;quot; which clients may find useful.  For example, many DAP-compliant servers provide HTML-formatted representations or ASCII representations of a data source&#039;s structure and data. Such additional services are discussed in Volume 2 of this specification.&lt;br /&gt;
&lt;br /&gt;
The DAP specification also defines extensions to the protocol and representing important, but optional, capabilities. At least the following extensions have been defined.&lt;br /&gt;
1. Asynchronous Response. The DAP Asynchronous Response is returned to a client when the requested resource (DMR, Data Response, etc.) is not immediately available and by making a specific request that it be made available the server is able to retrieve it. If the client makes the &amp;quot;retrieve it&amp;quot; request the server will inform the client through a subsequent Asynchronous Response when and where the client may access the requested resource.&lt;br /&gt;
2. CSV Data Encoding. The DAP4 CSV data encoding represents DAP4 data as structured Comma-Separated Values (CSV) in UTF-8 text. Though based on the text/csv media type described in RFC 4180[RFC 4180], the DAP4 CSV is more complex so that it can fully represent the more complex data structures of the DAP4 data model. Some structure beyond simple CSV is necessary to capture the DAP4 data structures.&lt;br /&gt;
&lt;br /&gt;
==Characterization of a Data Source==&lt;br /&gt;
&lt;br /&gt;
The DAP characterizes a data source as a collection of variables, dimensions, and enumeration types. Each variable consists of a name, a type, a value, and a collection of Attributes. Dimensions have a name and a size. Enumerations list names and values of the enumeration constants. These elements may be grouped into collections using the concept of a &amp;quot;group&amp;quot; that has an identifier and defines a naming scope for the elements within it. Groups may contain other groups.&lt;br /&gt;
&lt;br /&gt;
The distinction between information in a variable and in an Attribute is somewhat arbitrary. However, the intention is that Attributes hold information that aids in the interpretation of data held in a variable. Variables, on the other hand, hold the primary content of a data source.&lt;br /&gt;
&lt;br /&gt;
Section [[#DAP4 DMR Syntax as a RELAX NG Schema|13]] provides a formal syntax for DAP DMR characterizations. It is defined using the RelaxNG standard [13] for describing the context-free syntax of a class of XML documents, the DMR in this case. It should be noted that any syntax specification requires a specification of the lexical elements of the syntax.&lt;br /&gt;
The XML specification [16] provides most of the lexical context for the syntax, but there are certain places where additional lexical elements must be used. Section [[#DAP4 Lexical Elements|11]] describes those additional lexical elements, and those elements are discussed at appropriate points in this specification.&lt;br /&gt;
&lt;br /&gt;
Since the syntax is context-free, there are semantic limitations on what is legal in a DMR. These semantic limitations are noted at appropriate places in the following documentation. It should also be noted that if there are conflicts between what is described here and the RelaxNG syntax, then the syntax takes precedence.&lt;br /&gt;
&lt;br /&gt;
==DMR Declarations==&lt;br /&gt;
&lt;br /&gt;
===DMR XML Format===&lt;br /&gt;
&lt;br /&gt;
;Element and Attribute Names:&lt;br /&gt;
:Within the DMR XML document, it is assumed that XML element and XML attribute names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
;Character Escapes:&lt;br /&gt;
:Any string of characters appearing within an XML attribute in the DMR must apply the standard XML escapes.  Specifically, any attribute value containing any of the following characters must replace them with the corresponding XML escape form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;30%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;&amp;lt;td&amp;gt;&amp;amp;amp;amp;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;lt;&amp;lt;td&amp;gt;&amp;amp;amp;lt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;amp;gt;&amp;lt;td&amp;gt;&amp;amp;amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&amp;lt;td&amp;gt;&amp;amp;amp;quot;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example, given the occurrence of the attribute &lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;&amp;quot;&#039;&lt;br /&gt;
it must be re-written to this form&lt;br /&gt;
&#039;name=&amp;quot;&amp;amp;amp;amp;&amp;amp;amp;lt;&amp;amp;amp;gt;&amp;quot;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Names===&lt;br /&gt;
&lt;br /&gt;
A name (aka identifier) in DAP4 consists of a sequence of any legal non-control UTF-8 characters. A control character is any UTF-8 character in the inclusive range 0x00 &amp;amp;mdash; 0x1F. Names are case sensitive.&lt;br /&gt;
&lt;br /&gt;
===Fully Qualified Names===&lt;br /&gt;
&lt;br /&gt;
Every object in a DAP4 Dataset has a Fully Qualified Name (FQN), which provides a way to unambiguously reference declarations in a dataset and which can be used in several contexts such as in the DMR in a constraint expression&lt;br /&gt;
(see Section [[#Constraints|8]]).&lt;br /&gt;
These FQNs follow the common conventions of names for lexically scoped identifiers.  In DAP4 three kinds of lexical items provide lexical scoping: Dataset, Groups, Structures, and Sequences . Just as with hierarchical file systems or variables in many programming languages, a simple grammar formally defines how the names are built using the names of the FQN&#039;s components (see Section [[#FQN Syntax|10]]). Consider the following simple dataset, which contains a Structure named &amp;quot;inner&amp;quot; within a Structure named &amp;quot;outer&amp;quot; all contained in the Dataset &amp;quot;D&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN for the field &#039;temperature&#039; is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Substituting the keyword &#039;&#039;Sequence&#039;&#039; for one or more occurrences of &#039;&#039;Structure&#039;&#039; in the above example will leave the FQNs unchanged.&lt;br /&gt;
&lt;br /&gt;
As is the case with Structure or Sequence variables, Groups can be nested to form hierarchies, too, and this example shows that case.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;D&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Group name=&amp;quot;environmental_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;Structure name=&amp;quot;places&amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;String name=&amp;quot;name&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;Sequence name=&amp;quot;weather&amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;temperature&amp;quot;/&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;Float64 name=&amp;quot;dew_point&amp;quot;/&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
     &amp;amp;lt;Group name=&amp;quot;demographic_data&amp;quot;&amp;amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;amp;lt;/Group&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The FQN to the field &#039;temperature&#039; in the dataset shown is&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;/environmental_data/places.weather.temperature&#039;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Every dataset has a single outermost &amp;amp;lt;Dataset&amp;amp;gt; declaration,&lt;br /&gt;
which semantically, acts like the root group.&lt;br /&gt;
Whatever name that dataset has is ignored for the purposes of forming the FQN and instead is treated as if it has the empty name (&amp;quot;&amp;quot;).&lt;br /&gt;
&amp;lt;li&amp;gt;There is no limit to the nesting of groups or the nesting of Structures or the nesting of Sequences.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several characters such as &amp;quot;/&amp;quot; and &amp;quot;.&amp;quot; have special meaning in the context of a fully qualified name. This means that if a name is added to the FQN and that name contains either of those two characters, then those characters must be specially escaped so that they will not be misinterpreted. The defined escapes are as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;25%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Character&amp;lt;th&amp;gt;Escaped Form&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;.&amp;lt;th&amp;gt;\.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;/&amp;lt;th&amp;gt;\/&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;\&amp;lt;th&amp;gt;\\&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;blank &amp;lt;th&amp;gt;\blank&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the escape character itself must be escaped. Also note that this form of escape using &#039;\&#039; is independent of any required XML escape&lt;br /&gt;
(Section [[#XML Escaping Within the DMR|5.1]]).&lt;br /&gt;
&lt;br /&gt;
===FQN References===&lt;br /&gt;
DAP4 imposes the rule that the definition of any object (e.g. dimension,&lt;br /&gt;
group, or enumeration) must occur before any reference to that object.&lt;br /&gt;
This rule also applies within a group, which in turn implies that,&lt;br /&gt;
for example, all dimensions must be declared before all variables&lt;br /&gt;
that reference them.&lt;br /&gt;
&lt;br /&gt;
===Definitional Declarations versus Data-Bearing Declarations===&lt;br /&gt;
&lt;br /&gt;
The declarations in a DMR can be grouped into two classes.&lt;br /&gt;
One class is &amp;lt;i&amp;gt;definitional&amp;lt;/i&amp;gt;. That is, it defines metadata that is&lt;br /&gt;
used in the rest of the DMR.&lt;br /&gt;
These definitional declarations are Groups (including the outer Dataset),&lt;br /&gt;
Dimensions, and Enumerations.&lt;br /&gt;
Such declarations do not contain data values themselves, although they may define constants such as the dimension size.&lt;br /&gt;
The data-bearing declarations are Variables and Attributes.&lt;br /&gt;
These elements of the data model are used to house data values or semantic metadata read from the dataset (or, in the latter case) synthesized from the values and standards/conventions that the dataset is known to follow.&lt;br /&gt;
&lt;br /&gt;
===Dataset===&lt;br /&gt;
Every DMR contains exactly one Dataset declaration. It is the outermost&lt;br /&gt;
XML element of the DMR.&lt;br /&gt;
&lt;br /&gt;
A dataset is specified using this XML form:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;...&amp;quot; dapVersion=&amp;quot;...&amp;quot; dmrVersion=&amp;quot;...&amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt;, and &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt;,&lt;br /&gt;
attributes are required.&lt;br /&gt;
The attributes have the following semantics:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;name&amp;lt;/i&amp;gt; &amp;amp;ndash; an identifier specifying  the name of the dataset.&lt;br /&gt;
Its content is determined solely by the Server and is completely uninterpreted&lt;br /&gt;
with respect to DAP4.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dapVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;4.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;li&amp;gt; &amp;lt;i&amp;gt;dmrVersion&amp;lt;/i&amp;gt; &amp;amp;ndash; the string &amp;amp;quot;1.0&amp;amp;quot; currently.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The body of the Dataset is the same&lt;br /&gt;
as the body of a [[#Groups|5.7]],&lt;br /&gt;
and semantically the Dataset acts like the outermost, root, group.&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
A group is specified using this XML form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Group name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;amp;lt;Group&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A group defines a name space and contains other DAP elements. Specifically, it can contain groups, variables, dimensions, and enumerations. The fact that groups can be nested means that the set of groups in a DMR form a tree data structure. For any given DMR, there exists a root group that is the root of this tree.&lt;br /&gt;
&lt;br /&gt;
A nested set of groups defines a variety of name spaces and access to the contents of a group is specified using a notation of the form &amp;quot;/g1/g2/.../gn&amp;quot;. This is called a &amp;quot;path&amp;quot;. By convention &amp;quot;/&amp;quot; refers to the root group (the Dataset declaration). Thus the path &amp;quot;/g1/g2/g3&amp;quot; indicates that one should start in the root group, move to group g1 within that root group, then to group g2 within group g1, and finally to group g3. This is more fully described in the section on Fully Qualified names (Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&lt;br /&gt;
The order of declarations within a Group is fixed and must conform to&lt;br /&gt;
this order.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Enumeration declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; Variable declarations,&lt;br /&gt;
&amp;lt;li&amp;gt; and, finally, nested Group declarations,&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comparison purposes, DAP groups correspond to netCDF-4 groups and not to the more complex HDF5 Group type: i.e. the set of groups must form a tree.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If declared, Groups must be named.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;A Group can contain any number of objects, including other Groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Each Group declares a new lexical scope for the objects it contains. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;An array of Group is not allowed, and a Group cannot be defined within a Structure or Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Dimensions===&lt;br /&gt;
&lt;br /&gt;
A dimension declaration is specified using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Dimension name=&amp;quot;name&amp;quot; size=&amp;quot;size&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size is a positive integer (which means that a zero&lt;br /&gt;
length dimension is illegal).  As described in the&lt;br /&gt;
Arrays Section, the maximum size of any&lt;br /&gt;
dimension is 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.  A dimension declaration&lt;br /&gt;
will be referenced elsewhere in the DMR by specifying its&lt;br /&gt;
name. It should also be noted that anonymous dimensions also&lt;br /&gt;
exist. They have a size but no name. Anonymous dimensions&lt;br /&gt;
SHOULD NOT be declared.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension declarations are not associated with a data type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Dimension sizes MUST be a capable of being represented as a signed 64-bit integer.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enumeration Types===&lt;br /&gt;
&lt;br /&gt;
An enumeration type defines a set of names with specific values: enumeration constants. As will be seen in Section [[#Variables|5.12]], enumeration types may be used as the type for variables or attributes. The values that can be assigned to such typed objects must come from the set of enumeration constants.&lt;br /&gt;
&lt;br /&gt;
An enumeration type specifies a set of named, integer constants. When a data source has a variable of type &#039;Enumeration&#039; a DAP 4 server MUST represent that variable using a specified integer type, up to and including a 64-bit unsigned integer. &lt;br /&gt;
&lt;br /&gt;
An Enumeration type is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enumeration name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
                basetype=&amp;quot;Byte|Int8|UInt8|Int16|UInt16&lt;br /&gt;
                         |Int32|UInt32|Int64|UInt64&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;EnumConst name=&amp;quot;name&amp;quot; value=&amp;quot;integer&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;amp;lt;/Enumeration&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The optional &amp;quot;basetype&amp;quot; XML attribute defines the type for the value XML attribute of each enumeration constant. This basetype must be one of the integer types (see Section [[#Integer Types|5.10.1]]). If unspecified, then it defaults to the Atomic type &amp;quot;Int32&amp;quot;.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Atomic Types===&lt;br /&gt;
&lt;br /&gt;
The DAP4 specification assumes the existence of certain pre-defined, declared types called atomic types. As their name suggests, atomic data types are conceptually indivisible.  Atomic variables are used to store integers, real numbers, strings and URLs. There are five classes of atomic types, with each family containing one or more variations: integer, floating-point, string, enumerations, and opaque.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Integer Types&amp;quot;&amp;gt;Integer Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integer types are summarized in the following table.&lt;br /&gt;
The syntax for integer constants is defined in&lt;br /&gt;
Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Synonym for UInt8&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;[-(2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;), (2&amp;lt;sup&amp;gt;63&amp;lt;/sup&amp;gt;) - 1]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;[0, (2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;)  - 1]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that for historical reasons, the Char type is defined to be a synonym of UInt8, this mean that technically, the Char type has no associated character set encoding. However, servers and clients are free to infer typical character semantics to this type. The inferred character set encoding is chosen purely at the discretion of the server or client using whatever conventions they agree to use, possibly specified using attributes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Floating Point Types&amp;quot;&amp;gt;Floating Point Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The floating-point data types are summarized in Table 2. The two floating-point data types use IEEE 754 [6] to represent values. The two types correspond to ANSI C&#039;s float and double data types. The syntax for floating point constants is defined in Section [[#The Numeric Constant Classes: integer and float|11.3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit Floating-point number&amp;lt;td&amp;gt;Refer to the IEEE Floating Point Standard [6]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;String Types&amp;quot;&amp;gt;String Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string data types are summarized in Table 3.  Again, the syntax for these is defined in Section [[#The String/URL Constant Class|11.4]]&lt;br /&gt;
&lt;br /&gt;
Strings are individually sized. This means that in an array of strings, for example, each instance of that string MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Range of Legal Values&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;A variable length string of UTF-8 characters&amp;lt;td&amp;gt;As defined in [14]&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URI&amp;lt;td&amp;gt;A Uniform Resource Identifier&amp;lt;td&amp;gt;As defined in IETF RFC 2396 [8]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Opaque Type&amp;quot;&amp;gt;The Opaque Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Opaque type is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Opaque&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Opaque type is use to hold objects like JPEG images and other Binary Large Object (BLOB) data that have significant internal structure which might be understood by clients (e.g., an image display program) but that would be very cumbersome to describe using the DAP4 built-in types. Defining a variable of type &amp;quot;Opaque&amp;quot; does not communicate any information about its content, although an attribute could be used to do that.&lt;br /&gt;
&lt;br /&gt;
Opaque instances are individually sized. This means that in an array of opaques, for example, each instance of that opaque MAY be of a different size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The content of an opaque object is completely un-interpreted by the DAP4 implementation. The Opaque type is an Atomic Type, which might seem odd because instances of Opaque can be of different sizes. However, by thinking of Opaque as equivalent to a byte-string type, the analogy with strings makes it clear that it should be an Atomic type.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Enum Type&amp;quot;&amp;gt;The Enum Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for declaring an Enum type is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Enum enum=&amp;quot;FQN&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Enum type is intended to be used in the definition of a variable. It should not be confused with the definition of an Enumeration, but rather references such a definition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The Enum typed requires the an attribute that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note Regarding Implementation of the Atomic Types&amp;quot;&amp;gt;A Note Regarding Implementation of the Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When implementing the DAP, it is important to match information in a data source or read from a DAP response to the local data type which best fits those data. In some cases an exact match may not be possible. For example Java lacks unsigned integer types [4]. Implementations faced with such limitations MUST ensure that clients will be able to retrieve the full range of values from the data source. If this is impractical, then the server or client may implement this rule by hiding the variable in question or returning an error.&lt;br /&gt;
&lt;br /&gt;
===Container Types===&lt;br /&gt;
&lt;br /&gt;
There are currently two container types: &amp;amp;lt;Structure&amp;amp;gt; and &amp;amp;lt;Sequence&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Structure Type&amp;quot;&amp;gt;The Structure Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure groups a list of variables so that the collection can be manipulated as a single item. The variables in a Structure may also be referred to as &amp;quot;fields&amp;quot; to conform to conventional use of that term, but there is otherwise no distinction between fields and variables.  The Structure&#039;s fields MAY be of any type, including &#039;&#039;Structure&#039;&#039; or &#039;&#039;Sequence&#039;&#039;.  The order of items in the Structure is significant only in relation to the serialized representation of that Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;The Sequence Type&amp;quot;&amp;gt;The Sequence Type&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence is intended to represent a &#039;&#039;sequence&#039;&#039; of instances of objects.&lt;br /&gt;
Suppose that we have a sequence of this form.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;corresponding&#039;&#039; Structure object&lt;br /&gt;
is obtained by substituting the &#039;&#039;Sequence&#039;&#039;&lt;br /&gt;
keyword with &#039;&#039;Structure&#039;&#039;. Our above example&lt;br /&gt;
then has this associated Structure.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;field2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The semantics of a sequence are that it represents a sequence&lt;br /&gt;
of instances of the corresponding Structure. The length of the Sequence MAY be different for every instance of a Sequence. Consider this array of Sequence.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This represents an array of six (3 times 2) sequence instances. However, the length MAY be different for each of those six instances.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;amp;lt;Sequence&amp;amp;gt; construct was introduced to replace the concept of variable length dimensions. It turns out that trying to treat variable length dimensions as dimensions causes significant conceptual and implementation difficulties. It is hoped thatisolating such variable length objects syntactically is a better representation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY freely nested.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
Each variable in a data source MUST have a name, a type and one or more values. Using just this information and armed with an understanding of the definition ofv the DAP data types, a program can read any or all of the information from a data source.&lt;br /&gt;
&lt;br /&gt;
The DAP variables come in several different types. There are several atomic types, the basic indivisible types representing integers, floating point numbers and the like, and a container type &amp;amp;ndash; the Structure or Sequence type &amp;amp;ndash; that supports aggregation of other variables into a single unit. A container type may contain both atomic typed variable as well as other container typed variables, thus allowing nested type definitions.&lt;br /&gt;
&lt;br /&gt;
The DAP variables describe the data when it is being transferred from the server to the client.  It does not necessarily describe the format of the data inside the server or client. The DAP defines, for each data type described in this document, a serialized representation, which is the information actually communicated between DAP servers and DAP clients.  The serialized representation consists of two parts:  the declaration of the type and the serialized encoding of its value(s). The data representation is presented in&lt;br /&gt;
Section [[#Response Format|6.1]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arrays&amp;quot;&amp;gt;Arrays&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most (but not all) types may be arrays. An Array is a&lt;br /&gt;
multi-dimensional indexed data structure. An Array&#039;s member&lt;br /&gt;
variable MUST be of some DAP data type. Array indexes MUST&lt;br /&gt;
start at zero. Arrays MUST be stored in row-major order (as&lt;br /&gt;
is the case with ANSI C), which means that the order of&lt;br /&gt;
declaration of dimensions is significant. The size of each&lt;br /&gt;
Array&#039;s dimensions MUST be given.&lt;br /&gt;
The total number of elements in an Array is fixed as that&lt;br /&gt;
given by the product of the size(s) of its&lt;br /&gt;
dimension(s). Note that a dimension size of zero is illegal.&lt;br /&gt;
&lt;br /&gt;
For practical reasons having to do with current hardware&lt;br /&gt;
limitations, the total number of bytes allocated to an array&lt;br /&gt;
must fit in an unsigned 64-bit integer.&lt;br /&gt;
The largest atomic types currently defined in this document&lt;br /&gt;
are the floating point double and the (U)Int64 integer types.&lt;br /&gt;
This means that the practical limit on the total number of elements&lt;br /&gt;
is 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; / 8 = 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt;. Thus the dimension indices&lt;br /&gt;
will run from 0 to a maximum of 2&amp;lt;sup&amp;gt;61&amp;lt;/sup&amp;gt; - 1.&lt;br /&gt;
Of course this limit on the maximum number of elements also&lt;br /&gt;
applies to the maximum dimension size since the total number&lt;br /&gt;
of elements is the product of all the dimensions sizes of the array.&lt;br /&gt;
&lt;br /&gt;
There is a prescribed limit of 64 on the number of of&lt;br /&gt;
dimensions for a variable (i.e. its arity). This is actually&lt;br /&gt;
larger than will occur in practice.&lt;br /&gt;
Assuming a dimension must be at least 1 bit in size,&lt;br /&gt;
this effectively limits the number of dimensions to 61.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Simple variables (see below) MAY be arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Structures and Sequences MAY be arrays.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Simple Variables&amp;quot;&amp;gt;Simple Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple, dimensioned variable is declared using this XML form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;{fqn};&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim size=&amp;quot;{integer}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of two types of dimensions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; name=&amp;quot;{fqn}&amp;quot; &amp;amp;ndash; specify the fully qualified name of a dimensions&lt;br /&gt;
declared previously,&lt;br /&gt;
&amp;lt;li&amp;gt; size=&amp;quot;{integer}&amp;quot; &amp;amp;ndash; specify an anonymous dimension of a given size, &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple variable is one whose type is one of the Atomic Types&lt;br /&gt;
(see Section [[#Atomic Types|5.10]]). The name of the Atomic Type (Int32 in this example) is used as the XML element name. Within the body of that element, it is possible to specify zero or more dimension references. A dimension reference (&amp;amp;lt;Dim.../&amp;amp;gt;) MAY refer to a previously defined dimension declaration. It MAY also define an anonymous dimension with no name, but with a size specified as an integer constant.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; N.A.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Dimension Ordering&amp;quot;&amp;gt;Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;amp;lt;Dim name=&amp;quot;/dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered from top to bottom. From this, a corresponding left-to-right order [d1][d2]...[dn] can be inferred where the top dimension is the left-most and the bottom dimension is the right-most. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the right-most is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this left-to-right ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variables&amp;quot;&amp;gt;Structure Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a structure variable specifies a type as well as any dimension for that variable. The type, however, is a Structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structures&amp;quot;&amp;gt;Structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Structure typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Structure name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Structure contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Structure. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Structure typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Structures MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variables&amp;quot;&amp;gt;Sequence Variables&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with simple variables, a sequence variable specifies a type as well as any dimension for that variable. The type, however, is a Sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequences&amp;quot;&amp;gt;Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XML scheme for a Sequence typed variable is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Sequence name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  ...&lt;br /&gt;
  {variable definition}&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dim ... /&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Sequence contains within it a list of variable definitions&lt;br /&gt;
(Section [[#Variables|5.12]]).&lt;br /&gt;
For discussion convenience, each such variable may be referred to as a &amp;quot;field&amp;quot; of the Sequence. The list of fields may optionally be followed with a list of dimension references indicating the dimensions of the Sequence typed variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Sequences MAY be dimensioned.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Coverage Variables and Maps&amp;quot;&amp;gt;Coverage Variables and Maps&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Discrete Coverage&amp;quot; is a concept commonly found in many disciplines, where the term refers to a sampled function with both its domain and range explicitly enumerated by variables. DAP2 uses the name &#039;Grid&#039; to denote what the OGC calls a &#039;rectangular grid&#039; [12]. DAP4 expands on this so that other types of discrete coverages (hereafter &#039;coverage(s)&#039;) can be explicitly represented.&lt;br /&gt;
Note that the DAP2 &#039;&#039;Grid&#039;&#039; construct is gone, and is replaced by these coverages, which are more general than DAP2 Grids.&lt;br /&gt;
&lt;br /&gt;
Consider the example coverage function&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Temp: lat X lon -&amp;gt; Float32&lt;br /&gt;
where&lt;br /&gt;
lat and lon subsets of Float32 in the range [0,360).&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The range, is of course, &#039;&#039;Float32&#039;&#039; and the domain is &#039;&#039;lat X lon&#039;&#039;. The Temp function as a coverage is a sampled subset of the continuous function and is defined at some finite set of pairs from lat X lon.&lt;br /&gt;
&lt;br /&gt;
In DAP4, the range for a coverage is represented by a variable, Temp in this example, whose values are the range of the sampled function. Because the domain of &#039;&#039;Temp&#039;&#039; is a two-tuple (lat,lon), the DAP4 variable must have rank two. In order to complete the sampling of Temp, it is necessary to also define two &#039;Map&#039; (also called &#039;coordinate&#039;) variables representing the sampling of lat and lon. These two variables, lat and lon, have rank one each. Taken as whole, this collection of a variable plus maps is called a &amp;quot;grid&amp;quot; for convenience sake.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to access the value of the Temp function at position (x,y), where x is a value&lt;br /&gt;
in the lat variable and y is a value in the lon variable. The lat variable is consulted to find ilat&lt;br /&gt;
such that lat[ilat] = x. Similarly, we want the ilon index such that lon[ilon] = y. We can then obtain Temp(x,y) as the value of Temp[ilat][ilon]. This is probably the simplest example for using coverages and more complex examples exist for, for example, satellite swathes.&lt;br /&gt;
&lt;br /&gt;
Using OGC coverage terminology, we have this.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The maps (e.g. lat and lon) specify the &amp;quot;Domain&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The array (e.g. Temp) specifies the &amp;quot;Range&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Grid itself is a &amp;quot;Coverage&amp;quot; per OGC.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Domain and Range are sampled functions&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A map is defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Map name=&amp;quot;{FQN for some variable previously defined in the DMR}&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example might look like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;Temp&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Map name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where the map variables are defined elsewhere like this.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lat&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Float32 name=&amp;quot;/lon&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dim name=&amp;quot;/lon&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Float32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The containing variable, temp in the example, will be referred to as the &amp;quot;array variable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Each map variable MUST have a rank no more than that of the array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; An array variable can have as many maps as desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Why did we do this?&lt;br /&gt;
&amp;lt;li&amp;gt; The dimensions of the array variable may not contain duplicates so A[x,x] is disallowed.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Any map duplicates are ignored&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The order of declaration (top to bottom) MAY be significant.&lt;br /&gt;
&amp;lt;!-- why this limitations?&lt;br /&gt;
 and the order of declaration of the maps is irrelevant.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The fully qualified name of a map must either be in the same lexical scope as the array variable, or the map must be in some enclosing scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The set of named &amp;quot;associated dimensions for a map must be a subset of the set of named &amp;quot;associated dimensions&amp;quot; for the array variable.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;associated dimensions&amp;quot; is computed as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The set of associated dimensions is initialized to empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; For each element mentioned in the fully qualified name (FQN) of the map or the array variable, add any named dimensions associated with FQN element to the set of associated dimensions (removing duplicates, of course).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice, the means that an array variable or map variable must take into account any dimensions associated with any enclosing dimensioned Structure or Sequence.&lt;br /&gt;
&lt;br /&gt;
===Attributes and Arbitrary XML===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attributes&amp;quot;&amp;gt;Attributes&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attributes are defined using the following XML scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{atomic type name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Value value=&amp;quot;value&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;{container name}&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://netcdf.ucar.edu/cf&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  &amp;amp;lt;Attribute name=&amp;quot;name&amp;quot; type=&amp;quot;...&amp;quot;&amp;amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In DAP4, Attributes (not to be confused with XML attributes) are tuples with four components: &lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Name,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Type (one of the defined atomic types such as Int16, String, etc.), or a child attribute container,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Vector of one or more values,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Zero or more Namespaces&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This differs slightly from DAP2 Attributes because the namespace feature has been added, although clients can choose to ignore it. For more about namespaces, refer to Section [[#Namespaces|5.14]]. The intent of including the namespace information is to simplify interactions with semantic web applications where certain schemas or standards have formal definitions of attributes. &lt;br /&gt;
&lt;br /&gt;
Attributes are typically used to associate semantic metadata with the variables in a data source. Attributes are similar to variables in their range of types and values, except that they are somewhat limited when compared to those for variables: they cannot use Structure or Sequence types&lt;br /&gt;
&lt;br /&gt;
Attributes defined at the top-level within a group are also referred to as &amp;quot;group attributes&amp;quot;. Attributes defined at the root group (i.e. Dataset) are &amp;quot;global attributes,&amp;quot; which many file formats such as HDF4 or netCDF formally recognize. &lt;br /&gt;
&lt;br /&gt;
While the DAP does not require any particular Attributes, some may be required by various metadata conventions. The semantic metadata for a data source comprises the Attributes associated with that data source and its variables. Thus, Attributes provide a mechanism by which semantic metadata may be represented without prescribing that a data source use a particular semantic metadata convention or standard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;ins&amp;gt;Semantic Notes&amp;lt;/ins&amp;gt;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DAP4 explicitly treats an attribute with one value as an attribute whose value is a one-element vector. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; All of the atomic types are allowed as the type for an attribute&lt;br /&gt;
&amp;lt;li&amp;gt; If the attribute has type Enum, it must also have an XML attribute, &#039;&#039;enum&#039;&#039;, that references a previously defined &amp;amp;lt;Enumeration&amp;amp;gt; declaration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attribute value constants MUST conform to the appropriate constant format for the given attribute type and as defined in Section [[#DAP4 Lexical Elements|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Attributes may themselves have attributes: effectively leading to nested attributes. Such attributes are called container attributes. However container attributes may not have values; only lowest level (leaf) attributes may have values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Arbitrary XML content &amp;quot;&amp;gt;Arbitrary XML content &amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By supporting an explicit type to hold &amp;quot;arbitrary XML&amp;quot; markup, DAP4 provides a way for the protocol to transport information encoded in XML along with the attributes read from the dataset itself. This has proved very useful in work with semantic web software. &lt;br /&gt;
&lt;br /&gt;
The form on an otherXML declaration is as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;otherXML name=&amp;quot;name&amp;quot;&amp;amp;gt;&lt;br /&gt;
{arbitrary xml}&lt;br /&gt;
&amp;amp;lt;/otherXML&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no &amp;amp;lt;value/&amp;amp;gt; elements because the value of otherXML&lt;br /&gt;
is the xml inside the &amp;amp;lt;otherXML&amp;amp;gt;...&amp;amp;lt;/otherXML&amp;amp;gt;.&lt;br /&gt;
The text content of the otherXML element must be valid XML and must be distinct from the XML markup used to encode elements of the DAP4 data model (i.e., in a practical sense, the content of an &amp;amp;lt;OtherXML&amp;amp;gt; attribute will be in a namespace other than DAP4). XML content may appear anywhere that an attribute may appear.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Attribute and OtherXML Specification and Placement&amp;quot;&amp;gt;Attribute and OtherXML Specification and Placement&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Attribute and OtherXML declarations MAY occur within the body of the following XML elements: Group, Dataset, Dimension, Variable, Structure, Sequence, and Attribute.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
&lt;br /&gt;
All elements of the DMR &amp;amp;ndash; Dataset, Groups, Dimensions, Variables, and Attributes &amp;amp;ndash; can contain an associated Namespace element. The namespace&#039;s value is defined in the form of an XML style URI string defining the context for interpreting the element containing the namespace. Suppose, hypothetically, that we wanted to specify that an Attribute is to be interpreted as a CF convention [15]. One might specify this as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Attribute name=&amp;quot;latitude&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Namespace href=&amp;quot;http://cf.netcdf.unidata.ucar.edu&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;amp;lt;/Attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is not to claim that this is how to specify a CF convention [15].; this is purely illustrative.&lt;br /&gt;
&lt;br /&gt;
==Data Representation==&lt;br /&gt;
&lt;br /&gt;
Data can be an elusive concept. Data may exist in some storage format on some disk somewhere, on paper somewhere else, in active memory on some server, or transmitted along some wire between two computers. All these can still represent the same data. That is, there is an important distinction to be made between the data and its representation. The data can consist of numbers: abstract entities that usually represent measurements of something, somewhere. Data also consist of the relationships between those numbers, as when one number defines a time at which some quantity was measured.&lt;br /&gt;
&lt;br /&gt;
The abstract existence of data is in contrast to its concrete representation, which is how we manipulate and store it. Data can be stored as ASCII strings in a file on a disk, or as twos-complement integers in the memory of some computer, or as numbers printed on a page.  It can be stored in HDF5 [2], netCDF [5], GRIB[17], a relational database, or any number of other digital storage forms.&lt;br /&gt;
&lt;br /&gt;
The DAP specifies a particular representation of data, to be used in transmitting that data from one computer to another. This representation of some data is sometimes referred to as the serialized representation of that data, as distinguished from the representations used in some computer&#039;s memory. The DAP standard outlined in this document has nothing at all to say about how data is stored or represented on either the sending or the receiving computer. The DAP transmission format is completely independent of these details.&lt;br /&gt;
&lt;br /&gt;
===Response Format===&lt;br /&gt;
&lt;br /&gt;
There are two response formats that a server MUST provide to the client.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DMR-only response&lt;br /&gt;
&amp;lt;li&amp;gt; (DMR +) Data response&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;DMR-Only Response&amp;quot;&amp;gt;DMR-Only Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
If the client requests only the DMR, then it is returned as a standard XML encoded document. If constraints were specified, then the returned DMR may differ from the full DMR in that, for example, meta-data about only variables specified in the constraint will be returned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Data Response&amp;quot;&amp;gt;Data Response&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The DAP4 data response uses a format very similar to that used for DAP2;&lt;br /&gt;
the data payload is broken into two pieces.&lt;br /&gt;
The first part holds metadata describing the names and types of the variables in the response while the second part holds the values of those variables.&lt;br /&gt;
&lt;br /&gt;
The metadata information, sent as part 1 of the Data Response, is the DMR limited to just those variables included in the response. DAP attributes may be included, but MAY be ignored by the receiving client.&lt;br /&gt;
&lt;br /&gt;
Part 2 of the response consists of the binary data for each variable in the order they are listed in the DMR given as the response preface. DAP4 uses a receiver makes it right encoding, so the servers MAY simply write out binary data as they store it with the exceptions that floating-point data must be encoded according to IEEE 754[6] and Integer data must use twos-complement notation for signed types. Clients are responsible for performing byte-swapping operations needed to compute using the values retrieved.&lt;br /&gt;
&lt;br /&gt;
The Data Response is encoded using chunking scheme &lt;br /&gt;
(see Section [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]).&lt;br /&gt;
that breaks it into N parts where each part is prefixed with a chunk type and chunk byte count header. Chunk types include data and error types, making it simple for servers to indicate to clients that an error occurred during the transmission of the Data Response and (relatively) simple for clients to detect that error.&lt;br /&gt;
&lt;br /&gt;
As with DAP2, the response describe here is a document that can be stored on disk or sent as the payload using a number of network transport protocols, HTTP being the primary transport in practice. However, any protocol that can transmit a document can be used to transmit these responses. As such, all critical information needed to decode the response is completely self-contained.&lt;br /&gt;
&lt;br /&gt;
In the rest of this section we will describe the Data Response in the context of DAP4 using HTTP as its transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the DMR Part&amp;quot;&amp;gt;Format of the DMR Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first part (&#039;&#039;part&#039;&#039; is not to be confused with &#039;&#039;chunk&#039;&#039;) of the Data Response always contains the DMR. The Data Response, when DAP is using HTTP as a transport protocol, is the payload for an HTTP response. It is separated from the last of the HTTP response&#039;s MIME headers by a single blank line, which MIME defines as a carriage return (ASCII value 13) followed by a line feed (ASCII value 10). This combination can be abbreviated as CRLF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Format of the Data Part&amp;quot;&amp;gt;Format of the Data Part&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The second part of the Data response consists of the serialized variables as specified by the data DMR. The variable serializations are concatenated to form a single binary dataset. If requested, each variable&#039;s serialization is followed by a CRC32 checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Relationship to the Chunking format&amp;quot;&amp;gt;Relationship to the Chunking format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
The data response format is technically independent of the chunking format&lt;br /&gt;
(see [[#How the Chunked Encoding Affects the Data Response Format|6.1.3]]&amp;lt;/h3&amp;gt;).&lt;br /&gt;
The assumption is that the DMR will be in a chunk of its own, the first chunk,&lt;br /&gt;
and the serialized binary data will be in one or more additional chunks.&lt;br /&gt;
This produces a format like this&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{DMR Length in binary form}&lt;br /&gt;
{DMR}&lt;br /&gt;
CRLF&lt;br /&gt;
{Chunk 1 containing some portion of the serialized data}&lt;br /&gt;
...&lt;br /&gt;
{Chunk n containing the last portion of the serialized data}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above and in the following, the form &#039;{xxx}&#039;&lt;br /&gt;
is intended to represent any instance of the xxx.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;How the Chunked Encoding Affects the Data Response Format&amp;quot;&amp;gt;How the Chunked Encoding Affects the Data Response Format&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a sense, the chunked encoding does not affect the format of the Data Response at all. Conceptually, the entire binary Data Response is built and then passed through a &#039;chunking encoder&#039; transforming it into one that is broken up into a series of chunks. That &#039;chunked document&#039; is then sent as the payload of some transport protocol, e.g., HTTP. In practice, that would be a wasteful implementation because a server would need to hold the entire response in memory. A better implementation would, for HTTP, write the initial parts of the HTTP response (its response code and headers) and then use a pipeline of filters to perform the encoding operations. The intent of the chunking scheme is to make it possible for servers to build responses in small chunks, and once they know those parts have been built without error, send them to the client. Thus a server should choose the chunk size to be small enough to fit comfortably in memory but large enough to limit the amount of overhead spent by the software that encodes and decodes those chunks. When an error is detected, the normal flow of building chunks and sending the data along is broken and an error chunk should be sent&lt;br /&gt;
(See Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
&lt;br /&gt;
===The DAP4 Serialized Representation (DSR)===&lt;br /&gt;
&lt;br /&gt;
Given a DMR and the corresponding data, the serialized representation is formally described in this section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A Note on Dimension Ordering&amp;quot;&amp;gt;A Note on Dimension Ordering&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider this example.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32  name=&amp;quot;i&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d1&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;d2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;amp;lt;Dimension name=&amp;quot;dn&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The dimensions are considered ordered top-to-bottom textually. This order is linearized into a corresponding left-to-right order [d1][d2]...[dn]. The assumption of row-major order means that in enumerating all possible combinations of these dimensions, the rightmost is considered to vary the fastest. The terms &amp;quot;right(most)&amp;quot; or &amp;quot;left(most&amp;quot;) refer to this ordering of dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Order of Serialization&amp;quot;&amp;gt;Order of Serialization&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data appearing in a serialized representation is the concatenation of the variables specified in the tree of Groups within a DMR, where the variables in a group are taken in depth-first, top-to-bottom order. The term &amp;quot;top-to-bottom&amp;quot; refers to the textual ordering of the variables in an XML document specifying a given DMR.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Structure variable, then its data representation will be the concatenation of the variables it contains, which will appear in top-to-bottom order.&lt;br /&gt;
&lt;br /&gt;
If a variable is a Sequence variable, then its data representation will have two parts.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; A 64-bit signed &#039;&#039;count&#039;&#039; of the number of elements in the sequence&lt;br /&gt;
&amp;lt;li&amp;gt; &#039;&#039;Count&#039;&#039; instances of the [[#The Sequence Type|5.11.2]] for the Sequence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable has dimensions, then the contents of each dimensioned data item will appear concatenated and taken in row-major order.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable Representation&amp;quot;&amp;gt;Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given a dimensioned variable, it is represented as the N scalar values concatenated in row-major order.&lt;br /&gt;
&lt;br /&gt;
If the variable is scalar, then it is represented as a single scalar value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Numeric Scalar Atomic Types&amp;quot;&amp;gt;Numeric Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the numeric atomic types, scalar instances are represented as follows. In all cases a consistent byte ordering is assumed, but the choice of byte order is at the discretion of the program that generates the serial representation, typically a server program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int8&amp;lt;td&amp;gt;Signed 8-bit integer&amp;lt;td&amp;gt;8 bits &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt8&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;8 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Byte&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Char&amp;lt;td&amp;gt;Unsigned 8-bit integer&amp;lt;td&amp;gt;Same as UInt8 &lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int16&amp;lt;td&amp;gt;Signed 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt16&amp;lt;td&amp;gt;Unsigned 16-bit integer&amp;lt;td&amp;gt;16 bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int32&amp;lt;td&amp;gt;Signed 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt32&amp;lt;td&amp;gt;Unsigned 32-bit integer&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Int64&amp;lt;td&amp;gt;Signed 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;UInt64&amp;lt;td&amp;gt;Unsigned 64-bit integer&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float32&amp;lt;td&amp;gt;32-bit IEEE floating point&amp;lt;td&amp;gt;32-bits&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Float64&amp;lt;td&amp;gt;64-bit IEEE floating point&amp;lt;td&amp;gt;64-bits&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form: all numeric quantities are used as a raw, unsigned vector of N bytes, where N is 1 for Char, Int8, and UInt8; it is 2 for Int16 and UInt16; it is 4 for Int32, UInt32, and Float32; and it is 8 for Int64, UInt64, and Float64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Byte Swapping Rules&amp;quot;&amp;gt;Byte Swapping Rules&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server chooses to byte swap transmitted values, then the following swapping rules are used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;20%&amp;quot;&amp;gt;Size (bytes)&amp;lt;th&amp;gt;Byte Swapping Rules&amp;lt;th&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;1&amp;lt;td&amp;gt;Not Applicable.&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;2&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;4&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 0&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;8&amp;lt;td&amp;gt;Byte 0 -&amp;gt; Byte 7&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 1 -&amp;gt;Byte 6&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 2 -&amp;gt; Byte 5&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 3 -&amp;gt;Byte 4&lt;br /&gt;
&amp;lt;td&amp;gt;Byte 4 -&amp;gt; Byte 3&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 5 -&amp;gt;Byte 2&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 6 -&amp;gt; Byte 1&amp;lt;br&amp;gt;&lt;br /&gt;
Byte 7 -&amp;gt;Byte 0&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Variable-Length Scalar Atomic Types&amp;quot;&amp;gt;Variable-Length Scalar Atomic Types&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variable length atomic values are all represented as a signed 64-bit count followed by the data of the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Type Name&amp;lt;th&amp;gt;Description&amp;lt;th&amp;gt;Representation&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;String&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a UTF-8 String&amp;lt;td&amp;gt;The number of bytes in the string (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;URL&amp;lt;td&amp;gt;Vector of 8-bit bytes representing a URL&amp;lt;td&amp;gt;Same as String&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Opaque&amp;lt;td&amp;gt;Vector of un-interpreted 8-bit bytes&amp;lt;td&amp;gt;The number of bytes in the vector (in Int64 format) followed by the bytes.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In narrative form, instances of String, Opaque, and URL types are represented as a 64 bit length (treated as Int64) of the instance followed by the vector of bytes comprising the value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Structure Variable Representation&amp;quot;&amp;gt;Structure Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Structure typed variable is represented as the concatenation of the representations of the variables contained in the Structure taken in textual top-to-bottom order. This representation may be nested if one of the variables itself is a Structure variable. Dimensioned structures are represented in a form analogous to dimensioned variables of atomic type. The Structure array is represented by the concatenation of the instances of the dimensioned Structure, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
It should be noted that no padding is present in the structure representation.&lt;br /&gt;
One field&#039;s content is immediately followed by the next field&#039;s content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Sequence Variable Representation&amp;quot;&amp;gt;Sequence Variable Representation&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Sequence typed variable is represented as a count specifying the number of objects (not bytes) of the sequence followed by count instances of the corresponding Structure using the Structure representation rules. This representation may be nested if one of the variables itself is a Sequence variable. Dimensioned sequences are represented in a form analogous to dimensioned variables of atomic type. The Sequence array is represented by the concatenation of the instances of the dimensioned Sequence, where the instances are listed in row-major order. &lt;br /&gt;
&lt;br /&gt;
Each Sequence variable, then, consists of a length, L say, in Int64 form and giving the number of elements for a specific occurrence of the variable-length dimension. The count, L, is then followed by L instances of the serialized form of the sequence&#039;s corresponding structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Checksums&amp;quot;&amp;gt;Checksums&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an option, checksums will be computed for the values of&lt;br /&gt;
all the &amp;quot;top-level&amp;quot; variables present in the DMR of a returned&lt;br /&gt;
response from a server. The term &amp;quot;top-level&amp;quot; means that the variable&lt;br /&gt;
is not a field of a Structure (or Sequence) typed variable.&lt;br /&gt;
&lt;br /&gt;
The purpose of the checksum is to detect changes in data&lt;br /&gt;
over time. That is, if a client requests the same variable&lt;br /&gt;
and the returned checksums are the same, then the client may&lt;br /&gt;
infer that the data has not changed. The checksum is not&lt;br /&gt;
intended for transmission error detection, although the&lt;br /&gt;
client MAY use it for that purpose if it chooses.&lt;br /&gt;
&lt;br /&gt;
The checksum is made visible to the client by adding an attribute to each top-level variable in the DMR. This attribute is named &amp;quot;DAP4_Checksum_CRC32&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In all cases, the checksum is computed over the serialized representation of each top-level variable. The checksum is computed before any chunking&lt;br /&gt;
Section [[#DAP4 Chunked Data Representation|7]]) is applied.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a dmr-only request, then the&lt;br /&gt;
server will compute the checksum for each variable mentioned&lt;br /&gt;
in the DMR and will insert the &amp;quot;DAP4_Checksum_CRC32&amp;quot;&lt;br /&gt;
attribute in the DMR.&lt;br /&gt;
Note that this can have significant performance consequences&lt;br /&gt;
since the server may need to read and serialize&lt;br /&gt;
all of the data for all of the variables mentioned in the DMR&lt;br /&gt;
even though that data is not transmitted to the client.&lt;br /&gt;
&lt;br /&gt;
If the request to the server is a data&lt;br /&gt;
request, then the checksum value will follow the value of&lt;br /&gt;
the variable in the data part of the response.&lt;br /&gt;
The computed checksum is appended to the&lt;br /&gt;
serialized representation for transmission to the&lt;br /&gt;
client. Note that in this case, the client is expected to&lt;br /&gt;
add the &amp;quot;DAP4_Checksum_CRC32&amp;quot; attribute to the DMR.&lt;br /&gt;
&lt;br /&gt;
The default checksum algorithm is CRC32.  So the size of&lt;br /&gt;
each checksum inserted in the serialization will be a 32 bit&lt;br /&gt;
integer. The checksum integer will use the same endian&lt;br /&gt;
representation as for the all other data.&lt;br /&gt;
Note that CRC32 is not a cryptographically strong checksum, so it&lt;br /&gt;
is not suitable for detecting man-in-the-middle attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Historical Note&amp;quot;&amp;gt;Historical Note&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The encoding described in Section [[#Response Format|6.1]]&lt;br /&gt;
is similar to the serialization form of the DAP2 protocol [3], but has been extended to support arrays with a varying dimension and stripped of redundant information added by various XDR implementations.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Serialization rules are derived from, but not the same as, XDR [10]. The differences are as follows.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Values are encoded using the byte order of the server. This is the so-called &amp;quot;receiver makes it right&amp;quot; rule.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; No padding is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Floating point values always use the IEEE 754 standard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; One and two-byte values are not converted to four byte values.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example responses===&lt;br /&gt;
&lt;br /&gt;
In these examples, spaces and newlines have been added to make them easier to read. The real responses are more compact. Since this proposal is just about the form of the response - and it really focuses on the BLOB part - there is no mention of &#039;chunking.&#039; For information on how this BLOB will/could be chunked.&lt;br /&gt;
see Section [[#DAP4 Chunked Data Representation|7]].&lt;br /&gt;
NB: Some poetic license used in the following and the checksums for single integer values seems silly, but these are really simple examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single scalar&amp;quot;&amp;gt;A single scalar&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single array&amp;quot;&amp;gt;A single array&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;A single structure&amp;quot;&amp;gt;A single structure&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;S&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13&lt;br /&gt;
y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, there is a single variable at the top-level of the root Group, and that is S; so it is S for which we compute the checksum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;An array of structures&amp;quot;&amp;gt;An array of structures&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Structure name=&amp;quot;s&amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/Int32&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Float64 name=&amp;quot;y&amp;quot;/&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;Dim size=&amp;quot;3&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Structure&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y x00 x01 x02 x03 x10 x11 x12 x13 y&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Single array with sequence&amp;quot;&amp;gt;Single array with sequence&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;String name=&amp;quot;s&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;a-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;a&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Dim size=&amp;quot;2&amp;quot;/&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
16 This is a string&lt;br /&gt;
{checksum}&lt;br /&gt;
5 a0 a1 a2 a3 a4&lt;br /&gt;
{checksum}&lt;br /&gt;
3 x00 x01 x02 6 x00 x01 x02 x03 x04 x05&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The checksum calculation includes only the values of the variable, not the containing chunk&#039;s length bytes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; The Sequence objects are treated &#039;like strings&#039; and prefixed with a length count. In the last of the three variables, the dimensioned sequence &#039;&#039;x-star&#039;&#039; has two sequence instances&lt;br /&gt;
where the first sequence has 3 elements and the second has 6.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;span id=&amp;quot;Nested Sequences&amp;quot;&amp;gt;Nested Sequences&amp;lt;/span&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sequence &#039;x-star&#039; has a field that is itself a sequence. In the example, at the time of serialization &#039;x-star&#039; has three elements the inner sequence (of which there are three instances) have three, six and one element, respectively.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Content-Type: application/vnd.opendap.org.dap4.data&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
&amp;amp;lt;Dataset name=&amp;quot;foo&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;Sequence name=&amp;quot;x-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;Sequence name=&amp;quot;y-star&amp;quot;&amp;amp;gt;&lt;br /&gt;
          &amp;amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;amp;gt;&lt;br /&gt;
      &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
  &amp;amp;lt;/Sequence&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/Dataset&amp;amp;gt;&lt;br /&gt;
CRLF&lt;br /&gt;
{chunk count+tag}&lt;br /&gt;
3 3 x00 x01 x02 6 x10 x11 x12 x3 x14 x15 1 x20&lt;br /&gt;
{checksum}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DAP4 Chunked Data Representation==&lt;br /&gt;
&lt;br /&gt;
An important capability for DAP4 is supporting clients in determining when a data transmission fails. This is especially difficult when sending binary data&lt;br /&gt;
(Section [[#Response Format|6.1]]).&lt;br /&gt;
In order to support such a capability, the DAP4 protocol uses a simplified variation on the HTTP/1.1 chunked transmission format [9] to serialize the data part of the response document so that errors are simple to detect. Furthermore, this format is independent of the form or content of that part of the response, so the same format can be used with different response forms or dropped when/if DAP is used with protocols that support out-of-band error signaling, simplifying our ongoing refinement of the protocol.&lt;br /&gt;
&lt;br /&gt;
The data part of a response document is &amp;quot;chunked&amp;quot; in a fashion similar to that outlined in HTTP/1.1. However, in addition to a prefix indicating the size of the chunk, DAP4 includes a chunk-type code. This provides a way for the receiver to know if the next chunk is part of the data response or if it contains an error response (Section [[#DAP4 Error Response Format|12]]).&lt;br /&gt;
In the latter case, the client should assume that the data response has ended, even though the correct closing information was not provided.&lt;br /&gt;
&lt;br /&gt;
Each chunk is prefixed by a chunk header consisting of a chunk type and byte count, all contained in a single four-byte word. The encoding of this word is always network byte order (i.e. Big-Endian)&lt;br /&gt;
The chunk type will be encoded in the high-order byte of the four-byte word and chunk size will be given by the three remaining bytes of that word. The maximum chunk size possible is 2&amp;lt;sup&amp;gt;24&amp;lt;/sup&amp;gt; bytes. Immediately following the four-byte chunk header will be chunk-count bytes followed by another chunk header. More precisely the initial four bytes of the chunk are decoded using the following steps.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Treat the 32 bit header a single, big-endian, unsigned integer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Convert the integer to the local machine byte order by swapping bytes as necessary (Section [[#Byte Swapping Rules|6.2.3.2]]).&lt;br /&gt;
Let the resulting integer be called H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk type by the following expression: type = (H &amp;amp;gt;&amp;amp;gt; 24) &amp;amp;amp; 0xff (Using C-language operators).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Compute the chunk length by the following expression: length = (H &amp;amp;amp; 0x00ffffff) (Using C-language operators).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The chunk type is determined as a set of one or more flags.&lt;br /&gt;
Currently, the possible flags are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 0 &amp;amp;ndash; 0=&amp;gt; a data containing chunk;&lt;br /&gt;
1 =&amp;gt; The last data chunk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 1 &amp;amp;ndash; 1 =&amp;gt; the current chunk contains an error message; 0 =&amp;gt; the current chunk is not an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Bit 2 &amp;amp;ndash; 0 =&amp;gt; the data in this response&lt;br /&gt;
is encoded using Big-Endian (i.e. network byte order);&lt;br /&gt;
1 =&amp;gt; Little-Endian byte order.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
It is possible for a chunk type to have more than one of the&lt;br /&gt;
flags. So, for example, if the data fits into a single chunk, and we assume little-endian encoding,&lt;br /&gt;
then its chunk type would be End + LittleEndian.&lt;br /&gt;
&lt;br /&gt;
Error implies End, but if the Error flag is set,&lt;br /&gt;
then bit 0 should be treated as set even if it is not. &lt;br /&gt;
Note that in order for this to work, the chunk flags&lt;br /&gt;
values must be powers of two: e.g. 1, 2, 4.&lt;br /&gt;
&lt;br /&gt;
The Endian flag must be set only in the first Data&lt;br /&gt;
chunk. It applies to the whole response. If set in any&lt;br /&gt;
subsequent chunk type, it will be ignored.&lt;br /&gt;
&lt;br /&gt;
===Chunked Format Grammar===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chunked_response: chunklist ;&lt;br /&gt;
chunklist: chunk | chunklist chunk ;&lt;br /&gt;
chunk: CHUNKTYPE SIZE CHUNKDATA ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that there is semantic limitation in the definition of &#039;chunk&#039;:&lt;br /&gt;
the number of bytes in the CHUNKDATA must be equal to SIZE.&lt;br /&gt;
&lt;br /&gt;
===Lexical Structure===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* A single 8-bit byte,&lt;br /&gt;
   with the encoding 0 = data, 1 = end, 2 = error, 4 = Little-Endian */&lt;br /&gt;
CHUNKTYPE = &#039;\x00&#039;|&#039;\x01&#039;|&#039;\x02&#039;|&#039;\x4&#039;|&#039;\x06&#039;&lt;br /&gt;
/* A sequence of three 8-bit bytes,&lt;br /&gt;
  interpreted as an integer on network byte order */&lt;br /&gt;
SIZE = [\0x00-\0xFF][\0x00-\0xFF][\0x00-\0xFF]&lt;br /&gt;
CHUNKDATA = [\0x00-\0xFF]*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constraints==&lt;br /&gt;
A request to a DAP4 server for either metadata (the DMR) or data may include a constraint expression. This constraint expression specifies which variables are to be returned and what subset of the data for each variable is to be returned.&lt;br /&gt;
&lt;br /&gt;
This section defines the a constraint language that MUST be supported by any implementation claiming to support the DAP4 protocol. The method by which a server is provided with a constraint is specified in Volume 2. But as a typical example, if such a constraint were to be embedded in a URL, then it is presumed that it is prefixed with a &amp;quot;?dap4.ce=constraint-expression&amp;quot; that is appended to the end of the URL.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Constraint Expression (CE) syntax is an extension of the syntax used by DAP2 that adds some important new features for Arrays as well as addressing some ambiguities and structural problems in the DAP2 syntax. In this design we also introduce some new terminology to make the explanation of the CE syntax clearer. Additionally, we use a &#039;curly brace&#039; notation for datasets to streamline the description of datasets because the XML documents that DAP4 servers produce is verbose and hard for humans to read.&lt;br /&gt;
&lt;br /&gt;
When a client makes a request to a DAP4 server, it MAY send a CE where a missing (or empty) CE is interpreted to mean that the client wants the entire dataset sent. A CE is made up of a list of clauses, e&lt;br /&gt;
ach of which names a variable in the dataset that the client would like the server to send to it. Each clause can further be broken down into two parts: The subset expression and the filter expression. There are limitations on the CE clauses depending on variable type. For scalar variables, getting the variable is the only option available, so filter expression is supported, and if present, the only subset expression allowed is &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;. Structure variables can be subset by field but do not support filter expressions (although fields within a Structure may support filtering). Sequences can be subset by field and do support filters. Arrays support index subsets.&lt;br /&gt;
&lt;br /&gt;
Specifically, the new features added for DAP4 constraints include:&lt;br /&gt;
* Using a grouping operator for Structures and Sequences&lt;br /&gt;
* Sequence filtering expressions explicitly bound to a specific Sequence variable&lt;br /&gt;
* Multiple, disjoint index subsets.&lt;br /&gt;
&lt;br /&gt;
=== Terminology used by this section ===&lt;br /&gt;
;selection expression: The entire expression passed to the server that is used to choose specific parts of a dataset.&lt;br /&gt;
;subset: The act of choosing parts of a dataset based on the &#039;&#039;type&#039;&#039; of one or more of its variables. We define several types of subsetting operations as follows:&lt;br /&gt;
;index subsetting: Choosing parts of an array based on the indexes of that array&#039;s dimensions. This operation always returns an array of the same rank as the original, although the size of the return array will (likely) be smaller. Index subsetting uses the bracket syntax described subsequently.&lt;br /&gt;
;field subsetting: Choosing specific variables (fields) from the dataset. A dataset in DAP4 is made up of a number of variables and those may be Structures or Sequences that contain fields. Field subsetting uses the brace syntax described later. One or more fields can be specified using a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;) as the separator.&lt;br /&gt;
;filter: A filter is a predicate that can be used to choose sequence rows based on the values of fields of the sequence. the vertical bar (&#039;&#039;&#039;|&#039;&#039;&#039;) is used as a prefix operator for the filter predicate. Filters can be applied to fields of a Sequence. A filter predicate consists of one or more filter subexpressions. One or more subexpressions can be specified, using a comma (&#039;&#039;&#039;,&#039;&#039;&#039;) as the separator. Implicitly, multiple filter subexpressions are logically and&#039;ded together.&lt;br /&gt;
;filter subexpression: A simple expression that consists of a single variable/field; the expression is composed from traditional set of binary and unary operators: comparison operators (=, !=, &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=) for numbers and strings, and a string specific regular expression comparison operator (~=). The operands of the operators must be either numeric or string constants or a field of the Sequence. Specifically, only atomic-valued, scalar fields can be used in the filter expression.&lt;br /&gt;
&amp;lt;!-- and new operators for Arrays and Coverages (&amp;lt;&amp;lt;, &amp;gt;&amp;gt;, @=).--&amp;gt;&lt;br /&gt;
;id: The name of a variable. These must be absolute, with some specific exceptions. Absolute names are fully qualified names (See Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
;domain, range: A function is a mapping from a  set of &#039;&#039;domain&#039;&#039; values to a set of &#039;&#039;range&#039;&#039; values; in a &#039;&#039;discrete function&#039;&#039;, these sets are finite.&lt;br /&gt;
;discrete coverage: A &#039;&#039;discrete coverage&#039;&#039; is a (discrete) function where the indices of the arrays that hold the &#039;&#039;domain&#039;&#039; and &#039;&#039;range&#039;&#039; values have a one-to-one and onto mapping, with the important exception that in cases where the dimension of the arrays containing the domain values can be reduced without loosing information, that is done. This is purely an implementation optimization, but where applicable, it is nearly universally used. In DAP4 we call discrete coverages simply &#039;&#039;coverages&#039;&#039; or &#039;&#039;grids&#039;&#039;.&lt;br /&gt;
;coverage: Synonymous with &#039;&#039;grid&#039;&#039; in this document.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Subsetting Constraints ===&lt;br /&gt;
The simplest constraint is the null string and it means &#039;return everything&#039; from the dataset. Choosing variables in a dataset is referred to as the &#039;&#039;subset&#039;&#039;. To choose a subset of the variables in a dataset, enumerate them in a semicolon-separated list. To choose parts of a Structure, name those parts explicitly using the syntax &#039;&#039;structure_name{field name}&#039;&#039; or &#039;&#039;structure_name.field name&#039;&#039;. Each DAP4 dataset contains one or more Groups; the top-level Group is always present and is named &#039;&#039;/&#039;&#039; (pronounced &#039;root&#039;).&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If the root Group is the only Group in the dataset, it does not need to be named when listing variables in the CE. However, if there are other Groups in the dataset, each Group other than the root Group must be named. In any case, naming the root Group is optional.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example: subsetting by variable or field ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_1&amp;quot; &lt;br /&gt;
  dapVersion=&amp;quot;4.0&amp;quot; &lt;br /&gt;
  dmrVersion=&amp;quot;1.0&amp;quot; &lt;br /&gt;
  xml:base=&amp;quot;file:dap4/test_ce_1.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
  xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The syntax used for the examples is (hopefully) easier to read than the DAP4 DMR which uses XML; Curly braces indicate hierarchy.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point;&lt;br /&gt;
} vol_1_ce_1;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;&lt;br /&gt;
; Access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point{x}&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This notation is based on the use of brackets in [[DAP4: Proposal for Structure Projection]] and [[DAP4: DAP4 Filter Constraints]] with the exception that braces (&#039;&#039;&#039;&#039;&#039;{}&#039;&#039;&#039;&#039;&#039;) are likely easier to parse than brackets (&#039;&#039;&#039;&#039;&#039;[]&#039;&#039;&#039;&#039;&#039;) given that arrays of both Structure and Sequence are possible and thus with arrays of these structures the grammar that defines the constraint expression syntax would become context sensitive.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
; Equivalent expression to access just &#039;&#039;x&#039;&#039; within &#039;&#039;Point&#039;&#039;:  &#039;&#039;/Point.x&#039;&#039;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Access &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; by explicitly naming their Group: &#039;&#039;/u;/v&#039;&#039;. Every dataset in DAP4 has a root Group, written &#039;&#039;/&#039;&#039;. When that is the only Group in a dataset, it is implicit in the CE, but you can still use its name explicitly.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Group name=&amp;quot;inst2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;u&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;v&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &amp;lt;/Group&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u;&lt;br /&gt;
    Int32 v;&lt;br /&gt;
    Group {&lt;br /&gt;
        Int32 u;&lt;br /&gt;
        Int32 v;&lt;br /&gt;
	Structure {&lt;br /&gt;
	    Int32 x;&lt;br /&gt;
	    Int32 y;&lt;br /&gt;
	} Point;&lt;br /&gt;
   } inst2;&lt;br /&gt;
} vol_1_ce_2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v&#039;&#039;.&lt;br /&gt;
; Access  &#039;top-level&#039; &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039; and &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u;/v;/inst2/u;/inst2/v&#039;&#039;.&lt;br /&gt;
; Access &#039;&#039;inst2&#039;&#039;&#039;s &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/inst2/u;/inst2/v&#039;&#039;&lt;br /&gt;
; Access &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039;, which is inside the &#039;&#039;inst2&#039;&#039; Group: &#039;&#039;/inst2/Point{x}&#039;&#039; or &#039;&#039;/int2/Point.x&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes&#039;&#039;&#039;&lt;br /&gt;
* Using a semicolon is a change from DAP2 where clauses in the &#039;&#039;project part&#039;&#039; of the constraint were separated using a comma (&#039;&#039;,&#039;&#039;). We used semicolon because the comma is used elsewhere and using comma here made for a convoluted grammar. We wanted the grammar to be LALR(1) so that both table-driven and recursive-descent parsers would be easy to write.because it&#039;s easy to make both table and recursive descent parsers for these.&lt;br /&gt;
* Every name in a constraint should be a fully qualified name.&lt;br /&gt;
&amp;lt;!--As a notational simplification, we assume that non-qualified names are actually at the top dataset level (i.e., in the root group).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Array Subsetting in Index Space ===&lt;br /&gt;
Subsetting fixed-size arrays in their &#039;&#039;index space&#039;&#039; is accomplished using square brackets. The syntax closely follows that of DAP2, with some extensions. For an array with &#039;&#039;N&#039;&#039; dimensions, &#039;&#039;N&#039;&#039; sets of brackets are used, even if the array is only subset on some of the dimensions. The names of array variables are fully qualified names (FQNs) so it&#039;s possible to name arrays in structures and/or Groups. Array index values are &#039;&#039;zero-based&#039;&#039; as with a number of programming languages such as C and Java. Every array has a known starting index value of zero. Within the square brackets, several subexpressions are allowed:&lt;br /&gt;
; [ &#039;&#039;n&#039;&#039; ] : return only the value at a single index, where 0 &amp;lt;= n &amp;lt; N for a dimension of size &#039;&#039;N&#039;&#039;. This slicing operator does not reduce the dimensionality of an array, but does return a dimension size of one for the dimension to which this is applied.&lt;br /&gt;
; [ ] : return all of elements elements for a particular dimension &#039;&#039;or&#039;&#039; apply a shared dimension slice (more on this later).&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;last&#039;&#039; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;. This is the complete version of the syntax.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;  &#039;&#039;last&#039;&#039; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= last&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return the values whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= the dimension size - 1&#039;&#039;.&lt;br /&gt;
; [ &#039;&#039;start&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; &#039;&#039;step&#039;&#039; &amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt; ] : return every value whose index is in the range &#039;&#039;start &amp;amp;lt;= index &amp;amp;lt;= dimension size - 1&#039;&#039; and where &#039;&#039;(index - start) % step == 0&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The subsetting operator can be applied to any array. It can also be applied&lt;br /&gt;
to a scalar, but in this case, the only legal forms are &#039;&#039;[0]&#039;&#039; or &#039;&#039;[]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Example: Subsetting in Index Space ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_3&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;v&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][256];&lt;br /&gt;
    Int32 v[256][256];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Point[256];&lt;br /&gt;
} vol_1_ce_3;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Access all of &#039;&#039;u&#039;&#039;: &#039;&#039;/u&#039;&#039;&lt;br /&gt;
; Access all of &#039;&#039;Point&#039;&#039; &#039;s &#039;&#039;x&#039;&#039; field: &#039;&#039;/Point{x}&#039;&#039; or &#039;&#039;/Point.x&#039;&#039;. This returns an array of Structures with a single (Int32) element, not an array of Int32.&lt;br /&gt;
; Access elements 10 through 19 of array &#039;&#039;Point&#039;&#039;: &#039;&#039;/Point[10:19]&#039;&#039;. DAP4, like DAP2, uses zero-based indexes. This CE will return the 10th through the 19th elements (Structures in this case) of the array.&lt;br /&gt;
; Access every 4th element in the &#039;&#039;Point&#039;&#039; array: &#039;&#039;/Point[0:4:255]&#039;&#039;, or &#039;&#039;/Point[0:4:]&#039;&#039;. This is a simple decimation operation; this CE would return 64 Structures corresponding to elements at indexes 0, 3, 7, ..., 255 of the array.&lt;br /&gt;
; The index-space and field subsetting may be combined in the logical way: &#039;&#039;/Point[0:4:]{x}&#039;&#039; will return an array of structures (with 64 elements) named &#039;&#039;Point&#039;&#039; that contains a single &#039;&#039;Int32&#039;&#039; field named &#039;&#039;x&#039;&#039;.&lt;br /&gt;
&amp;lt;!-- Note that &amp;lt;del&amp;gt;&#039;&#039;/Point[0:4:].x&#039;&#039;&amp;lt;/del&amp;gt; is not accepted&lt;br /&gt;
; Access parts of &#039;&#039;u&#039;&#039; and &#039;&#039;v&#039;&#039;: &#039;&#039;/u[4:2:9];/v[4:2:9]&#039;&#039;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other possible CEs: &lt;br /&gt;
; &#039;&#039;/u[0:4:][0:4:]&#039;&#039;: every fourth element in both dimensions; this would return 1/16&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; of the array&#039;s data.&lt;br /&gt;
; &#039;&#039;/u[][10:19]&#039;&#039;: elements corresponding to every row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[7][10:19]&#039;&#039;: elements corresponding to the 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; row and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;u[10:19][10:19]&#039;&#039;: elements corresponding to rows 10 through 19 and columns 10 through 19.&lt;br /&gt;
; &#039;&#039;/u[0:19][0:19]&#039;&#039;: elements corresponding to rows 0 through 19 and columns 0 through 19.&lt;br /&gt;
; &#039;&#039;/u[][]&#039;&#039;: identical to &#039;&#039;/u&#039;&#039;, as are &#039;&#039;/u[0:][0:]&#039;&#039; and &#039;&#039;/u[0:1:][0:1:]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== More complex subsetting examples ====&lt;br /&gt;
&lt;br /&gt;
The data model for DAP4 is very similar to that of a modern structured programming language where &#039;&#039;constructor types&#039;&#039; like &#039;&#039;Structure&#039;&#039; may contain any allowed type (including other Structures, etc.) as well as being arrays themselves. The basic syntax for subsetting outlined so far can be applied to the fields of a Structure using braces to enclose the subsetting expression that apply to the fields of the Structure. This can be applied recursively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_4&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Point&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y[1024];&lt;br /&gt;
        Int32 z[256];&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points{y[7:256]}&#039;&#039; or &#039;&#039;/Points.y[7:256]&#039;&#039;: Get all of the elements of the Array of Structure &#039;&#039;Points&#039;&#039; and for each of those elements get the elements 7 through 256 from the field array &#039;&#039;y&#039;&#039;. Do not return the field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{y[0:9]}&#039;&#039; or &#039;&#039;/Points[0:9].y[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, only the  first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]{x;y[0:9]}&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; and, for each of those, return only all of &#039;&#039;x&#039; and the first ten elements of the array &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/Points[0:9]&#039;&#039;: Get the first ten elements of &#039;&#039;Points&#039;&#039; (both fields are included)&lt;br /&gt;
; &#039;&#039;/Points&#039;&#039; or &#039;&#039;/Points[]&#039;&#039; or &#039;&#039;/Points[0:]&#039;&#039;: Get all of &#039;&#039;Points&#039;&#039; with the subtle difference that if &#039;&#039;Points&#039;&#039; uses a shared dimension, the last of the three CEs will replace that with an anonymous dimension (see the section on shared dimensions, below).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_5&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Int32 name=&amp;quot;u&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Structure name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;height&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;pressure&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;/Structure&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Int32 u[256][1024];&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Structure {&lt;br /&gt;
            Int32 height[1024];&lt;br /&gt;
            Int32 pressure[1024];&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points[256];&lt;br /&gt;
} vol_1_ce_5;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points[0]{x,y,sounding{height[0:8:]}}&#039;&#039;: Get only the first element of &#039;&#039;Points&#039;&#039; and, for that, get the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; but for &#039;&#039;sounding&#039;&#039; get only every 8&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; element of the field &#039;&#039;height&#039;&#039; and elide the field &#039;&#039;pressure&#039;&#039;. An equivalent way of writing this expression is &#039;&#039;/Points[0]{x,y,sounding.height[0:8:]}&#039;&#039;. The &#039;&#039;{}&#039;&#039; syntax provides an easy way to request &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding.height[0:8:]&#039;&#039; without having to repeat &#039;&#039;/Points[0]&#039;&#039; three times. A CE like &#039;&#039;/Points[0].x;/Points[0].y;Points[0].soundings.height[0:8:]&#039;&#039; is legal, but &#039;&#039;/Points[0]&#039;&#039; will only appear once in the result and a CE where &#039;&#039;Points&#039;&#039; is sliced differently is not legal. That is, &amp;lt;del&amp;gt;&#039;&#039;Points[0].x;Points[0:10].y;Points[15].soundings.height[0:8:]&#039;&#039;&amp;lt;/del&amp;gt; is not legal because &#039;&#039;Points&#039;&#039; can appear only once in the result but has been sliced three different ways in the CE. In any CE, each variable can be constrained only one way.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Elide until implementation is complete&lt;br /&gt;
===Array subsetting with Disjoint Index Subsets===&lt;br /&gt;
As a new feature in DAP4 constraints, index subset within square brackets can contain multiple, disjoint slices, where each slice is of the most general form &#039;&#039;start:stride:last&#039;&#039;. The disjoint slices are separated by commas.&lt;br /&gt;
&lt;br /&gt;
Using the preceding example (dataset &#039;&#039;vol_1_ce_4&#039;&#039;), some disjoint index examples might be as follows.&lt;br /&gt;
; &#039;&#039;/u[10:12,19:23]&#039;&#039;: Access elements 10 through 12 and 19 through 23 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 3+5 = 11 elements. The values returned will be, in order,&lt;br /&gt;
&#039;&#039;u[10] u[11] u[12] u[19] u[20] u[21] u[22] u[23]&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/u[19:23, 10:12]&#039;&#039;: Access elements 19 through 23 and 10 through 12 of array &#039;&#039;u&#039;&#039;. The result will be an array of size 11, but the values returned will be in a different order, namely&lt;br /&gt;
&#039;&#039;u[19] u[20] u[21] u[22] u[23] u[10] u[11] u[12]&#039;&#039;.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How Sequences fit into this syntax ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Sequence&#039;&#039; type is more general data type in DAP4 than in DAP2 where it was significantly limited. In DAP4 Arrays of Sequences will be supported as will Sequence fields that are themselves Arrays or Sequences. A Sequence variable is conceptually like a table of rows where each field in the Sequence is a column in the table (or like an array of Structures, where the size of the single array dimension is a secret). Note that while there is a big difference between the value held by a Structure and a Sequence, each has the same subsetting syntax in the CE (although Sequences may have filters applied while Structures may not).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_6&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;s4&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;z&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;1024&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s1;&lt;br /&gt;
&lt;br /&gt;
   Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } s2[100];&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[10];&lt;br /&gt;
    } s3;&lt;br /&gt;
&lt;br /&gt;
     Sequence {&lt;br /&gt;
        Int32 z;&lt;br /&gt;
        Int32 x[1024];&lt;br /&gt;
    } s4[100];&lt;br /&gt;
} example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/s1&#039;&#039;: All of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x;y}&#039;&#039;: Also all of Sequence &#039;&#039;s1&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s1{x}&#039;&#039; or &#039;&#039;/s1.x&#039;&#039;: every &#039;row&#039; of Sequence &#039;&#039;s1&#039;&#039;, but just field &#039;&#039;x&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2{x;y}&#039;&#039;: All one hundred Sequences instances (not rows, but full sequences) of the Array &#039;&#039;s2&#039;&#039;. Same as &#039;&#039;/s2&#039;&#039; and &#039;&#039;/s2[0:99]{x,y}&#039;&#039; and &#039;&#039;/s2[]{x;y}&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s2[0:9]{x;y}&#039;&#039;: The first ten Sequence instances of &#039;&#039;s2&#039;&#039;. That would be 10 Sequences and for each, both the fields &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039;.&lt;br /&gt;
; &#039;&#039;/s3{} | z &amp;lt; 10&#039;&#039;: Every instance of the Sequence &#039;&#039;s3&#039;&#039; where z is less than 10. Note that this is the first example of a &#039;&#039;filter&#039;&#039;, a topic that is discussed in much more detail later on.&lt;br /&gt;
&lt;br /&gt;
=== Subsetting and Shared Dimensions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Shared Dimensions&#039;&#039; provide additional information to indicate that a group of arrays share certain relationships; that specific groups of the arrays form &#039;&#039;coverages&#039;&#039;  by indicating how dimensions of &#039;&#039;Maps&#039;&#039; and &#039;&#039;Arrays&#039;&#039; are linked. The DAP4 CE syntax provides a way to slice a Shared Dimension so that slice can be used by all of the arrays that use it without repeating the slicing operation for each Array. The syntax can be read &#039;Assign the shared dimension &#039;&#039;X&#039;&#039; this slice, where the slice looks like, for example, &#039;&#039;row=[10:19]&#039;&#039;.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The only difference syntactically between a shared dimension slice and the slice operator applied to a one  dimensional array is the assignment operator (&#039;&#039;=&#039;&#039;).--&amp;gt;&lt;br /&gt;
All of the variations of the slice operator possible for an array are accepted for shared dimension slicing. In any CE, all of the shared dimension slicing clauses must precede the variable subsetting clauses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; DAP4 uses XML for it&#039;s actual grammar, and because that&#039;s wordy this document includes a mock notation. I will extend that notation used so far so it includes concepts needed to mimic DAP4&#039;s notation for a coverage:&lt;br /&gt;
* The keyword &#039;&#039;Dimensions&#039;&#039; introduces a list of symbols and their sizes. (That is the definition of a Dimension in DAP4; a size bound to an identifier.)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Arrays where every dimension uses a &#039;&#039;Dimension&#039;&#039; to supply its extent are &#039;&#039;Maps&#039;&#039;. Maps are the arrays that hold the &#039;&#039;domain&#039;&#039; values for a &#039;&#039;coverage&#039;&#039;.&lt;br /&gt;
* Arrays that use parenthesis &#039;&#039;&#039;&#039;&#039;()&#039;&#039;&#039;&#039;&#039; in place of brackets to indicate the sizes of dimensions and which &#039;&#039;use the names of maps&#039;&#039; to do so &#039;&#039;for at least one dimension&#039;&#039; hold the &#039;&#039;range&#039;&#039; values for the coverage. These are the coverage&#039;s &#039;&#039;data array&#039;&#039; (aka &#039;&#039;array&#039;&#039; as distinct from &#039;&#039;maps&#039;&#039;).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* As with the previous examples, both the official and the mock syntax are shown and these datasets are available from the OPeNDAP test server.&lt;br /&gt;
&lt;br /&gt;
==== Example of this syntax ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_7&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;sal&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;O2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;CO2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Dimensions: nlat=100, nlon=50; &lt;br /&gt;
    Float32 lat[nlat];&lt;br /&gt;
    Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
    // The maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; are used here and define a coverage&lt;br /&gt;
    Float32 temp[lon][lat];&lt;br /&gt;
    Float32 sal[lon][lat];&lt;br /&gt;
    Float32 O2[lat][lon];&lt;br /&gt;
    Float32 CO2[lon][lat][10];&lt;br /&gt;
} shared_dimensions;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples of subsetting using shared dimensions ====&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat[nlat];lon[nlon];temp[nlat][nlon]&#039;&#039;: This will return Dimensions nlat=10, nlon = 10, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; such that lat an lon are 10 element vectors and &#039;&#039;temp&#039;&#039; is a 10 x 10 array.&lt;br /&gt;
Because the arrays are dimensioned using nlat and nlon in the original DMR, this expression can also be written as &#039;&#039;nlat=[0:9];nlon=[10:19];lat[];lon[];temp[][]&#039;&#039; or &#039;&#039;nlat=[0:9];nlon=[10:19];lat;lon;temp&#039;&#039;&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon; temp; sal&#039;&#039;: Same as above, but with both &#039;&#039;temp&#039;&#039; and &#039;&#039;sal&#039;&#039; included. This example shows how two or more arrays variables can be accessed along with their Maps without sending multiple copies of the Maps. Similarly, ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];lat; lon&#039;&#039;: This CE requests just the arrays that hold the domain values, while ...&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp; sal&#039;&#039;: This CE requests just the arrays that hold the range values. Taken together, the two preceding examples support clients that read the domain values first and then display a map (for example) providing a way for someone to view the data&#039;s geographical extent before accessing the values them selves. Also note that there is no restriction that the same shared dimension slices must be used for both requests; like DAP2, each request in DAP4 is &#039;&#039;stateless&#039;&#039;.&lt;br /&gt;
; &#039;&#039;nlat=[0:9];nlon=[10:19];temp[][]; sal[][]&#039;&#039;: This CE requests exactly the same data as the previous one, but uses the &#039;&#039;[]&#039;&#039; notation to indicate that the shared dimensions should be used for the subset. An example below shows how this notation can be used to mix local and shared dimension slicing.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2&#039;&#039;: This CE decimates &#039;&#039;CO2&#039;&#039; by returning every fourth value in the first two dimensions&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][][0:4:]&#039;&#039;: This CE introduces the second meaning for &#039;&#039;[]&#039;&#039;. When the empty braces are used for a dimension that corresponds to a shared dimension, it means &#039;&#039;use the shared dimension slice&#039;&#039;. This is useful because some arrays contain a mixture of shared and anonymous dimensions and it&#039;s desirable to slice both, using a shared dimension slice previously defined where applicable and an anonymous slice where that&#039;s needed. This expression will decimate &#039;&#039;CO2&#039;&#039; by four in each of its three dimensions.&lt;br /&gt;
; &#039;&#039;nlat=[0:4:];nlon=[0:4:];CO2[][1][0:4:]&#039;&#039;: To override the slicing provided by a shared dimension slice, simply replace the &#039;&#039;[]&#039;&#039; with a local dimension slice.&lt;br /&gt;
&lt;br /&gt;
=== Constrained DMR Objects ===&lt;br /&gt;
&lt;br /&gt;
When a DAP4 server receives a request for a Data response, it must build and return a Data Response Document that contains a text/xml part containing a DMR, a separator and a binary part that contains the data values. The organization of the Data Response Document is described in detail elsewhere in this document. In this section the focus is on the DMR returned in the first part of the response and how it relates to the DMR for the original unconstrained dataset. We refer to the original dataset&#039;s DMR as the &#039;&#039;DMR&#039;&#039; and the DMR associated with the data response as the &#039;&#039;CDMR&#039;&#039; (short-hand for Constrained DMR), although a data response can be generated using a null CE, we consider that a constraint, too.&lt;br /&gt;
&lt;br /&gt;
The DMR contains a number of declarations for the dataset: Enumerations, Dimensions, Attributes, Groups and Variables. Each DMR and CDMR must follow the rules for the DMR described in this specification and, because DAP4 is a stateless protocol, each response from a server must stand on its own. Since a Constraint Expression alters the data returned (limiting variables, changing the size of dimensions and so on), it stands to reason that the contents of the CDMR will vary for any given dataset based on the CE. Furthermore, a goal of DAP4 is to specify that the CDMR be &#039;minimal&#039; containing no unused definitions. &lt;br /&gt;
&lt;br /&gt;
Because filters alter the values of variables, but not whether a variable is returned, they have no affect on the CDMR. Only the subsetting operators will be discussed here.&lt;br /&gt;
&lt;br /&gt;
==== Enumerations ====&lt;br /&gt;
An enumeration is included in the CDMR if and only if some variable in the CE references it. A null CE returns the entire dataset, so it effectively references every variable.&lt;br /&gt;
&amp;lt;!--FIXME Make sure that &#039;variable&#039; and &#039;field&#039; are defined correctly in the terms section. jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Shared Dimensions ====&lt;br /&gt;
Shared Dimension declarations from the DMR are not included in the CDMR unless the Shared Dimension is used by a variable that has been projected and that variable does not override that shared dimension using a local slicing operation.&lt;br /&gt;
&amp;lt;!--FIXME Refer to the DMR from the previous section and show some examples.  jhrg 12/31/13--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
Each clause in the constraint must specify a variable and that variable will be declared in the CDMR. The variable must be referenced by a FQN.&lt;br /&gt;
&amp;lt;!--unless it is declared at the top level of the DMR and the short-hand notation is used where the leading slash (&#039;&#039;/&#039;&#039;) is elided.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Array Variables ====&lt;br /&gt;
Array variables follow all the rules for &#039;&#039;Variables&#039;&#039; with the additional conditions that their dimensions may appear altered depending on the CE. If the local slicing operations are used, then the sliced dimensions will have the size given be the slice operator, not the size as shown in the full dataset&#039;s DMR. If a shared dimension is sliced and the Array uses that slice, then its size will reflect that. Arrays may mix shared dimension slices and local slices and the result must be correctly reflected in the specific variable&#039;s declaration.&lt;br /&gt;
&lt;br /&gt;
Note that slicing never affects the &#039;&#039;rank&#039;&#039; of an array.&lt;br /&gt;
&lt;br /&gt;
==== Structure Variables ====&lt;br /&gt;
If the variable is a Structure, then either the entire Structure is included or a subset of its fields will be included in the variable declaration where the fields are those specifically mentioned in a constraint projection. As with all other variables, each variable in the structure will have the same rank and type as the original declaration in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Sequence Variables ====&lt;br /&gt;
If the variable is a Sequence, then for declaration&lt;br /&gt;
purposes, it is treated like a Structure (as above).&lt;br /&gt;
Note that applying a filter to a Sequence will not change&lt;br /&gt;
its declaration form because the number of records in the&lt;br /&gt;
sequence is not specified in the DMR. Note also that mentioning&lt;br /&gt;
a Sequence field in the filter does not necessarily mean it will&lt;br /&gt;
be included in the DMR. It will only be included if it is mentioned&lt;br /&gt;
in the projection part of the constraint clause.&lt;br /&gt;
&lt;br /&gt;
==== Groups ====&lt;br /&gt;
Each declaration in the CDMR that corresponds to a declaration&lt;br /&gt;
in the DMR will cause its containing group (and that group&#039;s parents)&lt;br /&gt;
to be included in the CDMR. This ensures that the FQN for a declaration&lt;br /&gt;
in the CDMR is the same as in the DMR.&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
Attributes are unaffected by the CE and are simply included in the CDMR, with the stipulation that attributes for variables that are not included in the CDMR won&#039;t be part of the CDMR. Essentially DAP4 views those attributes as part of the variables and explicitly excluding the variable from the CDMR (by providing a CE that does not include it) excludes its attributes too. Group level attributes&lt;br /&gt;
will be included if and only that group appears in the CDMR.&lt;br /&gt;
&lt;br /&gt;
There is one situation that bears mention, however. Many datasets contain variables which include attributes that describe domain-specific values for for the variables value(s). For example, imagine a atmospheric profile that includes information about the minimum and maximum temperatures of that profile. If the values are stored in an array and the array is sliced so that only a subset of values are returned, the attributes will provide correct values for the original data &#039;&#039;but possibly not the data returned in the response&#039;&#039; because the slicing operation has removed some of the values of the array. Because DAP4 is a &#039;&#039;domain neutral&#039;&#039; protocol, it has no knowledge about how the values of a specific attribute relate to the values of the variable and cannot adjust the values of the attribute to match the CE.&lt;br /&gt;
&lt;br /&gt;
=== Filters ===&lt;br /&gt;
While &#039;&#039;subsetting&#039;&#039; provides ways to choose data based on the dataset structure and the types of the variables, &#039;&#039;filters&#039;&#039; provide a way to choose data based on their values. The values to be returned are denoted using one or more simple predicates. The general syntax for a filter expression is to follow a subset (projection) expression with a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and one or more filter predicates. Multiple predicates are separated by commas and the value of complete predicate is the logical AND of the comma-separated subexpressions. &lt;br /&gt;
&lt;br /&gt;
Filter expressions can only be applied to Sequence variables (or arrays of them).&lt;br /&gt;
In each case the result of the filter operation returns &#039;&#039;the same type&#039;&#039; variable. A Sequence variable is essentially a table of values and thus can be thought of as containing a number of rows and the filter expression is applied to &#039;&#039;each row&#039;&#039; in the order those rows are provided to the expression evaluator. Every row that satisfies the predicate will be included in the value returned; those that don&#039;t will not be included in the result. Note that no new values are computed by these operations; no interpolations, means, etc., are performed.&lt;br /&gt;
&lt;br /&gt;
The behavior of filtering expressions on Sequences will be covered in the following sections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Filters on Sequences  ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points;&lt;br /&gt;
} arrays;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Filters and more complex data types ===&lt;br /&gt;
The basic syntax for filters is that there is a subsetting expression, a pipe (&#039;&#039;&#039;|&#039;&#039;&#039;) and then one or more filter predicates. This syntax can appear any place a &#039;&#039;selection expression&#039;&#039; can appear, so it can be used inside braces when an Array or Sequence is a field of a Structure or Sequence. Note that the filter expression prefix operator binds to the index subset immediately to its left at the same level (i.e. eliding braces). Some examples follow.&lt;br /&gt;
&lt;br /&gt;
==== Example: Filters on complex types ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_9&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Int32&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Sequence name=&amp;quot;Points2&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;sounding&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temp&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Structure name=&amp;quot;Points3&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Int32 name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Sequence name=&amp;quot;raw&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;depth&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;Int32 name=&amp;quot;temps&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;Dim size=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/Int32&amp;gt;&lt;br /&gt;
      &amp;lt;Dim size=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/Structure&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x[100];&lt;br /&gt;
        Int32 y;&lt;br /&gt;
    } Points1;&lt;br /&gt;
&lt;br /&gt;
    Sequence {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temp;&lt;br /&gt;
        } sounding;&lt;br /&gt;
    } Points2[20];&lt;br /&gt;
&lt;br /&gt;
    Structure {&lt;br /&gt;
        Int32 x;&lt;br /&gt;
        Int32 y;&lt;br /&gt;
        Sequence {&lt;br /&gt;
            Int32 depth;&lt;br /&gt;
            Int32 temps[4];&lt;br /&gt;
        } raw;&lt;br /&gt;
    } Points3[100]&lt;br /&gt;
&lt;br /&gt;
} complex_types_example;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;/Points1{x[0:9]}|y&amp;lt;3&#039;&#039;: For the Sequence &#039;&#039;Points1&#039;&#039;, return the rows of data where &#039;&#039;y&#039;&#039; is less than 3. In those rows, subset &#039;&#039;x&#039;&#039; so that only the first ten elements are included. Note that y is mentioned in the filter, but not in the selection so it will not appear in the resulting DMR.&lt;br /&gt;
; &#039;&#039;/Points2[10:19] { x; y; sounding | depth &amp;gt; 10 } | 20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039;: This selection expression first finds the index subset of &#039;&#039;Points2&#039;&#039; and arranges to return the fields &#039;&#039;x&#039;&#039;, &#039;&#039;y&#039;&#039; and &#039;&#039;sounding&#039;&#039; where &#039;&#039;x&#039;&#039;and &#039;&#039;y&#039;&#039; satisfy the predicates &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and &#039;&#039;y &amp;lt;35&#039;&#039; and for the field &#039;&#039;sounding&#039;&#039;, which is a Sequence itself, it will return both fields where &#039;&#039;depth &amp;gt; 10&#039;&#039;. This example points out an important aspect to the syntax and to expression evaluation: the order of evaluation of the filter predicates happens after the index and  variable and/or field subsetting. The order of evaluation of the complete filter predicates can happen in any order (i.e., the &#039;&#039;20 &amp;lt; x &amp;lt; 40, y &amp;lt;35&#039;&#039; and &#039;&#039;depth &amp;gt; 10&#039;&#039; predicates can happen in any order. The order of evaluation of the filter predicate subexpressions (i.e., &#039;&#039;20 &amp;lt; x &amp;lt; 40&#039;&#039; and  &#039;&#039;y &amp;lt;35&#039;&#039;) is also unspecified.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &#039;&#039;/Points3[3:2:8] {x; y; raw{temps[2] | temps &amp;gt; 7,ND=-1}}&#039;&#039;: In this expression the &#039;&#039;temps&#039;&#039; field of the Sequence &#039;&#039;raw&#039;&#039; is still an Array, it&#039;s just an Array with a single element, which illustrates that neither the subsetting nor filtering operations alter the types of the variables.&lt;br /&gt;
&lt;br /&gt;
=== The Mask operator may be applied only to an Array ===&lt;br /&gt;
For this predicate, the syntax is &#039;&#039;dest *= source&#039;&#039; where any element&amp;lt;sub&amp;gt;&#039;&#039;&#039;i,j&#039;&#039;&#039;&amp;lt;/sub&amp;gt; in the &#039;&#039;source&#039;&#039; array with the value equal to the given &#039;&#039;No Data&#039;&#039; value will result in the corresponding element of the &#039;&#039;dest&#039;&#039; array being set to that array&#039;s &#039;&#039;No Data&#039;&#039; value. Other values in the &#039;&#039;dest&#039;&#039; array are not affected. The intent of this is that filtering performed on a map array can then be applied to a data array that uses the map (although there&#039;s no actual restriction that this be only used with coverages; any two isomorphic arrays in an anonymous group can be used). To use the Mask (&#039;&#039;*=&#039;&#039;) predicate, the array on the Right Hand Side of the sub-clause must have been previously filtered (and so must have a given ND value).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_10&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Float32 lat[100][50];&lt;br /&gt;
	Float32 lon[100][50];&lt;br /&gt;
	Float32 temp[100][50];&lt;br /&gt;
} vol_1_ce_10;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20, ND=-255; temp | temp *= lat, ND=-255&#039;&#039;: Filter &#039;&#039;lat&#039;&#039; so that all values  &amp;lt; 20 are replaced with the No Data value, then use that as a mask, making all of the corresponding elements of &#039;temp&#039;&#039; also be No Data. Note that this operator forces an order on filter evaluation.&lt;br /&gt;
; &#039;&#039;lat[0:20][0:20] | lat &amp;lt; 20, ND=-255; lon[0:20][0:20] | -100 &amp;lt; lon &amp;lt; -80, ND=-255; temp[0:20][0:20] | temp *= lon, temp *= lat, ND=-255&#039;&#039;: This will result in &#039;&#039;temp&#039;&#039; effectively being masked by the logical AND of &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Filters and Coverages ====&lt;br /&gt;
The same filtering operations that can be applied to simple arrays can be applied to a coverage by simply using its Maps in the Constraint expression (i.e., the subset and filter sub-expressions). The array filtering operation previously described can easily be applied to a coverage. Below we show two cases; where the maps are vectors and where they are two-dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_11&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_11.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlat&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;nlon&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;nlat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: nlat=100, nlon=50; &lt;br /&gt;
	Float32 lat[nlat];&lt;br /&gt;
	Float32 lon[nlon];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} vector_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: Return all of &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; where &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have ben filtered as per the predicates. The values of &#039;&#039;temp&#039;&#039; are not altered.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: The same as above, but the maps &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; and the array &#039;&#039;temp&#039;&#039; are subset using the index subsetting expression and the resulting arrays are filtered. Note that because this is a coverage, the Maps&#039; dimensions are tied to &#039;&#039;temp&#039;&#039;&#039;s dimensions using Shared Dimensions and we can use the Shared Dimension slicing to specify the slicing once and use it for all three of the Maps/Arrays. That is, &#039;&#039;lat&#039;&#039;, &#039;&#039;lon&#039;&#039; and &#039;&#039;temp&#039;&#039; are each subset using &#039;&#039;[0:20][0:20]&#039;&#039;. Contrast this with the corresponding example in the previous section where the slicing subset had to be explicitly specified for each Array.&lt;br /&gt;
; &#039;&#039;nlat=[0:20]; nlon=[0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;: Same as above, but now &#039;&#039;temp&#039;&#039; is filtered too. Note that the filters applied to &#039;&#039;lat&#039;&#039; and &#039;&#039;lon&#039;&#039; have no affect on &#039;&#039;temp&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Dataset name=&amp;quot;vol_1_ce_12&amp;quot; dapVersion=&amp;quot;4.0&amp;quot; dmrVersion=&amp;quot;1.0&amp;quot; xml:base=&amp;quot;file:dap4/vol_1_ce_12.xml&amp;quot;&lt;br /&gt;
  xmlns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot; xmlns:dap=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;x&amp;quot; size=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;Dimension name=&amp;quot;y&amp;quot; size=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lat&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;lon&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Float32 name=&amp;quot;temp&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;x&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Dim name=&amp;quot;y&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lon&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Map name=&amp;quot;lat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/Float32&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;/Dataset&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Dataset {&lt;br /&gt;
	Dimensions: x=100, y=50;&lt;br /&gt;
	Float32 lat[x][y];&lt;br /&gt;
	Float32 lon[x][y];&lt;br /&gt;
&lt;br /&gt;
	Float32 temp(lon)(lat);&lt;br /&gt;
} two_dim_maps;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; &#039;&#039;lat | lat &amp;lt; 20,ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: These examples repeat the above three, but show that the same syntax applies to the case where the maps are N-dimensional (in this case N == 2).&lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp&#039;&#039;: &lt;br /&gt;
:; &#039;&#039;lat=[0:20][0:20]; lon=[0:20][0:20]; lat | lat &amp;lt; 20, ND=-255; lon | -100 &amp;lt; lon &amp;lt; -80, ND=-255&#039;; temp &amp;gt; 7, ND=-255&#039;&#039;:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Caron, J.,&lt;br /&gt;
&amp;lt;i&amp;gt;Unidata&#039;s Common Data Model Version 4&amp;lt;/i&amp;gt;, 2012&lt;br /&gt;
(http://www.unidata.ucar.edu/software/netcdf-java/CDM/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Folk, M. and E. Pourmal,&lt;br /&gt;
&amp;lt;i&amp;gt;HDF5 Data Model, File Format and Library &amp;amp;mdash; HDF5 1.6&amp;lt;/i&amp;gt;,&lt;br /&gt;
Category: Recommended Standard January 2007&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-007, 2007&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/ese-rfc-007/ESDS-RFC-007v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gallagher J., N. Potter, T. Sgouros, S. Hankin, and G. Flierl,&lt;br /&gt;
&amp;lt;i&amp;gt;The Data Access Protocol&amp;amp;mdash;DAP 2.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESE-RFC-004.1.2&lt;br /&gt;
(http://opendap.org/pdf/ESE-RFC-004v1.2.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Gosling, J., B. Joy, G. Steele, G. Bracha, A Buckley,&lt;br /&gt;
&amp;lt;i&amp;gt;The Java™ Language Specification &amp;amp;mdash; 7th Editition&amp;lt;/i&amp;gt;&lt;br /&gt;
Oracle Corporation, 2012,&lt;br /&gt;
(http://docs.oracle.com/javase/specs/jls/se7/html/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Hartnett, E.,&lt;br /&gt;
&amp;lt;i&amp;gt;netCDF-4/HDF5 File Format&amp;lt;/i&amp;gt;,&lt;br /&gt;
NASA Earth Science Data Systems Recommended Standard ESDS-RFC-022, 2011&lt;br /&gt;
(http://earthdata.nasa.gov/sites/default/files/field/document/ESDS-RFC-022v1.pdf).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-6&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
IEEE, &amp;lt;i&amp;gt;IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985&amp;lt;/i&amp;gt;, Digital Object Identifier: 10.1109/IEEESTD.1985.82928, 1985.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-7&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2119:&lt;br /&gt;
Key words for use in RFCs to Indicate Requirement Levels&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1997&lt;br /&gt;
(http://tools.ietf.org/html/rfc2119).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-8&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2396:&lt;br /&gt;
Uniform Resource Identifiers (URI): Generic Syntax&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1998&lt;br /&gt;
(http://tools.ietf.org/html/rfc2396).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-9&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 2616:&lt;br /&gt;
Hypertext Transfer Protocol &amp;amp;mdash; HTTP/1.1&lt;br /&gt;
&amp;lt;/i&amp;gt;, 1999&lt;br /&gt;
(http://tools.ietf.org/html/rfc2616).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Internet Society, &amp;lt;i&amp;gt;IETF RFC 4506: XDR: External Data Representation Standard&amp;lt;/i&amp;gt;, 2006&lt;br /&gt;
(http://tools.ietf.org/html/rfc4506).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-11&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
ISO/IEC,&lt;br /&gt;
&amp;lt;i&amp;gt;Information technology &amp;amp;mdash; Portable Operating System Interface (POSIX) &amp;amp;mdash; Part 2: Shell and Utilities&amp;lt;/i&amp;gt;,&lt;br /&gt;
ISO/IEC 9945-2,1993&lt;br /&gt;
(http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Open Geospatial Consortium Inc.,&lt;br /&gt;
&amp;lt;i&amp;gt;Abstract Specifications&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.opengeospatial.org/standards/as).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Organization for the Advancement of Structured Information Standards,&lt;br /&gt;
&amp;lt;i&amp;gt;RELAX NG Specification&amp;lt;/i&amp;gt;,&lt;br /&gt;
Committee Specification: 2001,&lt;br /&gt;
J. Clark, M. Makoto (eds.)&lt;br /&gt;
(http://relaxng.org/spec-20011203.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-14&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
The Unicode Consortium. &amp;lt;i&amp;gt;The Unicode Standard, Version 6.2.0&amp;lt;/i&amp;gt;,  ISBN 978-1-936213-07-8, 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Unidata,&lt;br /&gt;
&amp;lt;i&amp;gt;CF Metadata&amp;lt;/i&amp;gt;,&lt;br /&gt;
(http://www.cfconventions.org/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
W3C, &amp;lt;i&amp;gt;Extensible Markup Language (XML) 1.0&amp;lt;/i&amp;gt;,&lt;br /&gt;
T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau (eds.),&lt;br /&gt;
Fifth Edition. 2008&lt;br /&gt;
(http://www.w3.org/TR/2008/REC-xml-20081126/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div id=&amp;quot;Ref-17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
World Meteorological Organization,&lt;br /&gt;
&amp;lt;i&amp;gt;FM 92 GRIB&amp;lt;/i&amp;gt;,&lt;br /&gt;
edition 2, version 2, 2003&lt;br /&gt;
(http://www.wmo.int/pages/prog/www/DPS/FM92-GRIB2-11-2003.pdf).007&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Appendices=&lt;br /&gt;
&lt;br /&gt;
==Appendix 1. DAP4 DMR Syntax as a RELAX NG Schema==&lt;br /&gt;
&lt;br /&gt;
This RELAX NG grammar is the definitive formal grammar for the DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;gt;&lt;br /&gt;
&amp;lt;!-- RELAX NG Grammar --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Date: June 15, 2012 --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Last Revised: November 23, 2012 --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
         xmlns:a=&amp;quot;http://relaxng.org/ns/compatibility/annotations/1.0&amp;quot;&lt;br /&gt;
         datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
         ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
         &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;dataset&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dataset&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dataset&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic restriction: dapVersion, dmrVersion are required.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dapVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;dmrVersion&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Group&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupbody&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;groupbody&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;dimdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;enumdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;groupdef&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Enumeration&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;basetype&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt; &amp;lt;!-- Must be consistent with atomictype and variable --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt; &amp;lt;!-- equivalent to UInt8 --&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
            &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;oneOrMore&amp;gt;&amp;lt;ref name=&amp;quot;enumconst&amp;quot;/&amp;gt;&amp;lt;/oneOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;enumconst&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;EnumConst&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;namespace&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Namespace&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;href&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_uri&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimdef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dimension&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
      A Dimension is a binding of a name to a size; when two or more variables&lt;br /&gt;
      use the same &#039;name&#039; it can be inferred that they &#039;share&#039; that dimension.&lt;br /&gt;
      The &#039;size&#039; attribute must be a positive integer.&lt;br /&gt;
    &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadatalist&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;dimref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Dim&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
        &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;size&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;data type=&amp;quot;dap4_dim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Atomictype define is only a way&lt;br /&gt;
     to list the set of atomictypes;&lt;br /&gt;
     it is never used in the grammar&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomictype&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!-- This must be consistent with &amp;quot;variable&amp;quot; below --&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
    &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;simplevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;structurevariable&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;sequencevariable&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;simplevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Following  must be consistent with &amp;quot;atomictype&amp;quot; --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Char&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Byte&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int8&amp;quot;   &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt8&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int16&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt16&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int32&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt32&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Int64&amp;quot;  &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;UInt64&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float32&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Float64&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Made &#039;string&#039; capitalized. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;String&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Added URL type. jhrg --&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;URL&amp;quot; &amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Opaque&amp;quot;&amp;gt;&amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;Enum&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;enum&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;variabledef&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;variabledef&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;mapref&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;mapref&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Map&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;structurevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Structure&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;sequencevariable&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Sequence&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
      &amp;lt;choice&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;dimref&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;variable&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/choice&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadatalist&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;metadata&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;metadata&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;otherxml&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;attribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;choice&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;atomicattribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;containerattribute&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/choice&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;atomicattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;a:documentation&amp;gt;&lt;br /&gt;
        Semantic constraint: type must be compatible&lt;br /&gt;
        with the set of attribute value types&lt;br /&gt;
      &amp;lt;/a:documentation&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;type&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Char&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Byte&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt8&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt16&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Int64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;UInt64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float32&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Float64&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;String&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;URL&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Enum&amp;lt;/value&amp;gt;&lt;br /&gt;
          &amp;lt;value&amp;gt;Opaque&amp;lt;/value&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;optional&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;namespace&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/optional&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;attribute name=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;choice&amp;gt; &amp;lt;!-- technical ambiguity --&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_float&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_opaque&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_char&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;gt;&lt;br /&gt;
                    &amp;lt;data type=&amp;quot;dap4_fqn&amp;quot;/&amp;gt; &amp;lt;!-- for enum types --&amp;gt;&lt;br /&gt;
                &amp;lt;/choice&amp;gt;&lt;br /&gt;
              &amp;lt;/attribute&amp;gt;&lt;br /&gt;
         &amp;lt;/element&amp;gt;&lt;br /&gt;
	 &amp;lt;element name=&amp;quot;Value&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_text&amp;quot;/&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
	&amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;containerattribute&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Attribute&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;attribute name=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_id&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
	&amp;lt;ref name=&amp;quot;attribute&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;otherxml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;OtherXML&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;arbitraryxml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;element&amp;gt;&lt;br /&gt;
      &amp;lt;anyName/&amp;gt;&lt;br /&gt;
      &amp;lt;zeroOrMore&amp;gt;&lt;br /&gt;
        &amp;lt;choice&amp;gt;&lt;br /&gt;
          &amp;lt;attribute&amp;gt;&lt;br /&gt;
            &amp;lt;anyName/&amp;gt;&lt;br /&gt;
          &amp;lt;/attribute&amp;gt;&lt;br /&gt;
          &amp;lt;text/&amp;gt;&lt;br /&gt;
          &amp;lt;ref name=&amp;quot;arbitraryxml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/choice&amp;gt;&lt;br /&gt;
      &amp;lt;/zeroOrMore&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/grammar&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 RELAX NG Lexical Elements==&lt;br /&gt;
Within the RELAXNG DAP4 grammar there are markers for occurrences of primitive type such as integers, floats, or strings (ignoring case). The markers typically look like this when defining an attribute that can occur in the DAP4 DMR.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;attribute name=&amp;quot;Principal_Investigator&amp;quot;&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;datatype=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/attribute&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The &amp;quot;&amp;amp;lt;data type=&amp;quot;dap4_string&amp;quot;/&amp;amp;gt;&amp;quot; specifies the lexical class for the values that this attribute can have. In this case, the &amp;quot;Principal_Investigator&amp;quot; attribute is defined to have a DAP4 string value. Similar notation is used for values occurring as text within an xml element.&lt;br /&gt;
&lt;br /&gt;
The lexical specification later in this section defines the legal lexical structure for such items. Specifically, it defines the format of the following lexical items.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Constants, namely: string, float, integer, character, and opaque.&lt;br /&gt;
&amp;lt;li&amp;gt; Identifiers&lt;br /&gt;
&amp;lt;li&amp;gt; Fully qualified names (also referred to as FQNs)&lt;br /&gt;
(Section [[#Fully Qualified Names|5.3]]).&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
The specification is written using the extended POSIX regular expression notation [11] with some additions.&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Names are assigned to regular expressions using the notation &amp;quot;name = regular-expression&amp;quot;&lt;br /&gt;
&amp;lt;li&amp;gt; Named expressions can be used in subsequent regular expressions by using the notation &amp;quot;{name}&amp;quot;. Such occurrences are equivalent to textually substituting the expression associated with name for the &amp;quot;{name}&amp;quot; occurrence.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The definition of {UTF8} is deferred to the next section.&lt;br /&gt;
&amp;lt;li&amp;gt; Comments are indicated using the &amp;quot;//&amp;quot; notation. Standard xml escape formats (&amp;amp;amp;x#DDD; or &amp;amp;amp;{name};) are assumed to be used as needed.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic character set definitions===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONTROLS   = [\x00-\x1F] // ASCII control characters&lt;br /&gt;
&lt;br /&gt;
WHITESPACE = [ \r\n\t\f]+&lt;br /&gt;
&lt;br /&gt;
HEXCHAR    = [0-9a-zA-Z]&lt;br /&gt;
&lt;br /&gt;
// ASCII printable characters&lt;br /&gt;
&lt;br /&gt;
ASCII = [0-9a-zA-Z !&amp;quot;#$%&amp;amp;amp;&#039;()*+,-./:;&amp;amp;lt;=&amp;amp;gt;?@[\\\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ascii characters that may appear unescaped in Identifiers===&lt;br /&gt;
&lt;br /&gt;
This is assumed to be basically all ASCII printable characters except these characters: &#039;.&#039;, &#039;/&#039;, &#039;&amp;quot;&#039;, &#039;&amp;amp;#39;&#039;,  and &#039;&amp;amp;amp;&#039;. Occurrences of these characters are assumed to be representable using the standard XML &amp;amp;amp;{name}; notation (e.g. &amp;amp;amp;amp;). In this expression, backslash is interpreted as an escape character.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IDASCII=[0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Numeric Constant Classes: integer and float===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INTEGER    = {INT}|{UINT}|{HEXINT}&lt;br /&gt;
&lt;br /&gt;
INT        = [+-][0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
UINT       = [0-9]+{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
HEXINT     = {HEXSTRING}{INTTYPE}?&lt;br /&gt;
&lt;br /&gt;
INTTYPE    = ([BbSsLl]|&amp;quot;ll&amp;quot;|&amp;quot;LL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
HEXSTRING  = (0[xX]{HEXCHAR}+)&lt;br /&gt;
&lt;br /&gt;
FLOAT      = ({MANTISSA}{EXPONENT}?)|{NANINF}&lt;br /&gt;
&lt;br /&gt;
EXPONENT   = ([eE][+-]?[0-9]+)&lt;br /&gt;
&lt;br /&gt;
MANTISSA   = [+-]?[0-9]*\.[0-9]*&lt;br /&gt;
&lt;br /&gt;
NANINF     = (-?inf|nan|NaN)B.1.4 The String Constant Class&lt;br /&gt;
&lt;br /&gt;
STRING     = ([^&amp;quot;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})*&lt;br /&gt;
&lt;br /&gt;
CHAR       = ([^&#039;&amp;amp;amp;&amp;amp;lt;&amp;amp;gt;]|{XMLESCAPE})&lt;br /&gt;
&lt;br /&gt;
URL        = (http|https|[:][/][/][a-zA-Z0-9\-]+&lt;br /&gt;
             ([.][a-zA-Z\-]+)+([:][0-9]+)?&lt;br /&gt;
             ([/]([a-zA-Z0-9\-._,&#039;\\+%)*&lt;br /&gt;
             ([?].+)?([#].+)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The String/URL Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STRING = &amp;quot;\({SIMPLESTRING}{ESCAPEDQUOTE}?\)*&amp;quot;&lt;br /&gt;
SIMPLESTRING = [^&amp;quot;\\]&lt;br /&gt;
ESCAPEDQOTE=\\&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Opaque Constant Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OPAQUE = 0x([0-9A-Fa-f] [0-9A-Fa-f])+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a semantic constraint that if there is an odd&lt;br /&gt;
number of hex digits in the opaque constant, a zero hex digit&lt;br /&gt;
will be added to the end to ensure that the constant represents&lt;br /&gt;
a set of 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
===The Identifier Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ID         = {IDCHAR}+&lt;br /&gt;
&lt;br /&gt;
IDCHAR     = ({IDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
&lt;br /&gt;
XMLESCAPE  = [&amp;amp;amp;][#][0-9]+;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The Atomic Type Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ATOMICTYPE =   Char | Byte&lt;br /&gt;
             | Int8 | UInt8 | Int16 | UInt16&lt;br /&gt;
             | Int32 | UInt32 | Int64 | UInt64&lt;br /&gt;
             | Float32 | Float64&lt;br /&gt;
             | String | URL&lt;br /&gt;
             | Enum&lt;br /&gt;
             | Opaque ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This list should be consistent with the atomic types in the grammar. &lt;br /&gt;
&lt;br /&gt;
===The Fully Qualified Name Class===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
FQN      = ([/]{EID})+([.]{EID})*&lt;br /&gt;
EID      = {EIDCHAR}+&lt;br /&gt;
EIDCHAR  =  ({EIDASCII}|{XMLESCAPE}|{UTF8})&lt;br /&gt;
EIDASCII = [0-9a-zA-Z!#$%()*+:;&amp;lt;=&amp;gt;?@\[\]\\^_`|{}~]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This should be consistent with the definition in Section [[#Fully Qualified Names|5.3]].&lt;br /&gt;
&lt;br /&gt;
==Appendix 2. DAP4 Type Definitions==&lt;br /&gt;
&lt;br /&gt;
The RELAXNG [13] grammar references the following specific types. For each type, the following table give the lexical format as defined by the patterns previously given or by specific patterns as listed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;RELAXNG Data Type Name&amp;lt;th&amp;gt;Lexical Pattern&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_integer&amp;lt;td&amp;gt;{INTEGER}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_float&amp;lt;td&amp;gt;{FLOAT}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_char&amp;lt;td&amp;gt;{CHAR}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_string&amp;lt;td&amp;gt;{STRING}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_opaque&amp;lt;td&amp;gt;{OPAQUE}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_id&amp;lt;td&amp;gt;{ID}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_fqn&amp;lt;td&amp;gt;{FQN}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_uri&amp;lt;td&amp;gt;{URL}&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;dap4_dim&amp;lt;td&amp;gt;[1-9][0-9]*&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the above lexical element classes are not disjoint.  The type element &amp;quot;&amp;amp;lt;datatype=.../&amp;amp;gt;&amp;quot; should be sufficient to interpret the type within the DMR.&lt;br /&gt;
&lt;br /&gt;
==Appendix 3. UTF-8==&lt;br /&gt;
The UTF-8 specification [14] defines several ways to validate a UTF-8 string of characters.&lt;br /&gt;
&lt;br /&gt;
The full (most correct) validating version of UTF8 character set is as follows.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =   ([\xC2-\xDF][\x80-\xBF])&lt;br /&gt;
       | (\xE0[\xA0-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xE1-\xEC][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xED[\x80-\x9F][\x80-\xBF])&lt;br /&gt;
       | ([\xEE-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | ([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
       | (\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
The lines of the above expression cover the UTF-8 characters as follows:&lt;br /&gt;
1. non-overlong 2-byte&lt;br /&gt;
2.  excluding overlongs&lt;br /&gt;
3. straight 3-byte&lt;br /&gt;
4. excluding surrogates&lt;br /&gt;
5. straight 3-byte&lt;br /&gt;
6. planes 1-3&lt;br /&gt;
7. planes 4-15&lt;br /&gt;
8. plane 16&lt;br /&gt;
&lt;br /&gt;
Note that values from 0 through 127 (ASCII and control characters)&lt;br /&gt;
are not included in any of these definitions.&lt;br /&gt;
&lt;br /&gt;
The above reference also defines some alternative regular expressions. First, there is what is termed the partially relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 =    ([\xC0-\xD6][\x80-\xBF])&lt;br /&gt;
        | ([\xE0-\xEF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
        | ([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Second, there is what is termed the most-relaxed version of UTF8 defined by this regular expression.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
UTF8 = ([\xC0-\xD6]...)|([\xE0-\xEF)...)|([\xF0 \xF7]...)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Any conforming DAP4 implementation MUST use at least the most-relaxed expression for validating UTF-8 character strings, but MAY use either the partially-relaxed or the full validation expression. &lt;br /&gt;
&lt;br /&gt;
==Appendix 4. LALR(1) Grammar for DMR using Bison Notation==&lt;br /&gt;
It is conventient to have a Bison grammar that corresponds to the above RELAX NG grammar. If there is a conflict, then the RELAX NG grammar is considered correct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start dataset&lt;br /&gt;
%%&lt;br /&gt;
dataset:&lt;br /&gt;
	DATASET_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	groupbody&lt;br /&gt;
	_DATASET&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
group:&lt;br /&gt;
	GROUP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	groupbody&lt;br /&gt;
	_GROUP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
groupbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| groupbody dimdef&lt;br /&gt;
	| groupbody enumdef&lt;br /&gt;
	| groupbody variable&lt;br /&gt;
	| groupbody metadata&lt;br /&gt;
	| groupbody group&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumdef:&lt;br /&gt;
	ENUMERATION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	enumconst_list&lt;br /&gt;
	_ENUMERATION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst_list:&lt;br /&gt;
	  enumconst&lt;br /&gt;
	| enumconst_list enumconst&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumconst:&lt;br /&gt;
	  ENUMCONST_ ATTR_NAME ATTR_VALUE _ENUMCONST&lt;br /&gt;
	| ENUMCONST_ ATTR_VALUE ATTR_NAME _ENUMCONST&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimdef:&lt;br /&gt;
	DIMENSION_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_DIMENSION&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimref:&lt;br /&gt;
	  DIM_ ATTR_NAME _DIM&lt;br /&gt;
	| DIM_ ATTR_SIZE _DIM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
variable:&lt;br /&gt;
	  atomicvariable&lt;br /&gt;
	| enumvariable&lt;br /&gt;
	| structurevariable&lt;br /&gt;
	| sequencevariable&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomicvariable:&lt;br /&gt;
	atomictype_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	varbody&lt;br /&gt;
	_atomictype&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
enumvariable:&lt;br /&gt;
	ENUM_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	varbody&lt;br /&gt;
	_ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
atomictype_:&lt;br /&gt;
	  CHAR&lt;br /&gt;
	| BYTE&lt;br /&gt;
	| INT8&lt;br /&gt;
	| UINT8&lt;br /&gt;
	| INT16&lt;br /&gt;
	| UINT16&lt;br /&gt;
	| INT32&lt;br /&gt;
	| UINT32&lt;br /&gt;
	| INT64&lt;br /&gt;
	| UINT64&lt;br /&gt;
	| FLOAT32&lt;br /&gt;
	| FLOAT64&lt;br /&gt;
	| STRING&lt;br /&gt;
	| URL&lt;br /&gt;
	| OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
_atomictype:&lt;br /&gt;
	  _CHA&lt;br /&gt;
	| _BYT&lt;br /&gt;
	| _INT&lt;br /&gt;
	| _UINT&lt;br /&gt;
	| _INT1&lt;br /&gt;
	| _UINT1&lt;br /&gt;
	| _INT3&lt;br /&gt;
	| _UINT3&lt;br /&gt;
	| _INT6&lt;br /&gt;
	| _UINT6&lt;br /&gt;
	| _FLOAT3&lt;br /&gt;
	| _FLOAT6&lt;br /&gt;
	| _STRIN&lt;br /&gt;
	| _UR&lt;br /&gt;
	| _OPAQU&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
varbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| varbody dimref&lt;br /&gt;
	| varbody mapref&lt;br /&gt;
	| varbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
mapref:&lt;br /&gt;
	MAP_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	metadatalist&lt;br /&gt;
	_MAP&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structurevariable:&lt;br /&gt;
	STRUCTURE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	structbody&lt;br /&gt;
	_STRUCTURE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
structbody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| structbody variable&lt;br /&gt;
	| structbody dimref&lt;br /&gt;
	| structbody mapref&lt;br /&gt;
	| structbody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencevariable:&lt;br /&gt;
	SEQUENCE_&lt;br /&gt;
	ATTR_NAME&lt;br /&gt;
	sequencebody&lt;br /&gt;
	_SEQUENCE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
sequencebody:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| sequencebody dimref&lt;br /&gt;
	| sequencebody variable&lt;br /&gt;
	| sequencebody mapref&lt;br /&gt;
	| sequencebody metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadatalist:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| metadatalist metadata&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
metadata:&lt;br /&gt;
	  attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attribute:&lt;br /&gt;
	  atomicattribute&lt;br /&gt;
	| containerattribute&lt;br /&gt;
	| otherxml&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
atomicattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  valuelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	|&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| namespace_list namespace&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
namespace:&lt;br /&gt;
	NAMESPACE_&lt;br /&gt;
	ATTR_HREF&lt;br /&gt;
	_NAMESPACE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
containerattribute:&lt;br /&gt;
	  ATTRIBUTE_&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  namespace_list&lt;br /&gt;
	  attributelist&lt;br /&gt;
	  _ATTRIBUTE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
attributelist:&lt;br /&gt;
	  attribute&lt;br /&gt;
	| attributelist attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
valuelist:&lt;br /&gt;
	  value&lt;br /&gt;
	| valuelist value&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
value:&lt;br /&gt;
	  VALUE_ TEXT _VALUE&lt;br /&gt;
	| VALUE_ ATTR_VALUE _VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
otherxml:&lt;br /&gt;
	OTHERXML_&lt;br /&gt;
	xml_attribute_list&lt;br /&gt;
	xml_body&lt;br /&gt;
	_OTHERXML&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_body:&lt;br /&gt;
	  element_or_text&lt;br /&gt;
	| xml_body element_or_text&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
element_or_text:&lt;br /&gt;
	  xml_open&lt;br /&gt;
	  xml_attribute_list&lt;br /&gt;
	  xml_body&lt;br /&gt;
	  xml_close&lt;br /&gt;
	| TEXT&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute_list:&lt;br /&gt;
	  %empty&lt;br /&gt;
	| xml_attribute_list xml_attribute&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_attribute:&lt;br /&gt;
	  ATTR_BASE&lt;br /&gt;
	| ATTR_BASETYPE&lt;br /&gt;
	| ATTR_DAPVERSION&lt;br /&gt;
	| ATTR_DMRVERSION&lt;br /&gt;
	| ATTR_ENUM&lt;br /&gt;
	| ATTR_HREF&lt;br /&gt;
	| ATTR_NAME&lt;br /&gt;
	| ATTR_NAMESPACE&lt;br /&gt;
	| ATTR_NS&lt;br /&gt;
	| ATTR_SIZE&lt;br /&gt;
	| ATTR_TYPE&lt;br /&gt;
	| ATTR_VALUE&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_open:&lt;br /&gt;
	  DATASET_&lt;br /&gt;
	| GROUP_&lt;br /&gt;
	| ENUMERATION_&lt;br /&gt;
	| ENUMCONST_&lt;br /&gt;
	| NAMESPACE_&lt;br /&gt;
	| DIMENSION_&lt;br /&gt;
	| DIM_&lt;br /&gt;
	| ENUM_&lt;br /&gt;
	| MAP_&lt;br /&gt;
	| STRUCTURE_&lt;br /&gt;
	| SEQUENCE_&lt;br /&gt;
	| VALUE_&lt;br /&gt;
	| ATTRIBUTE_&lt;br /&gt;
	| OTHERXML_&lt;br /&gt;
	| CHAR_&lt;br /&gt;
	| BYTE_&lt;br /&gt;
	| INT8_&lt;br /&gt;
	| UINT8_&lt;br /&gt;
	| INT16_&lt;br /&gt;
	| UINT16_&lt;br /&gt;
	| INT32_&lt;br /&gt;
	| UINT32_&lt;br /&gt;
	| INT64_&lt;br /&gt;
	| UINT64_&lt;br /&gt;
	| FLOAT32_&lt;br /&gt;
	| FLOAT64_&lt;br /&gt;
	| STRING_&lt;br /&gt;
	| URL_&lt;br /&gt;
	| OPAQUE_&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
xml_close:&lt;br /&gt;
	  _DATASET&lt;br /&gt;
	| _GROUP&lt;br /&gt;
	| _ENUMERATION&lt;br /&gt;
	| _ENUMCONST&lt;br /&gt;
	| _NAMESPACE&lt;br /&gt;
	| _DIMENSION&lt;br /&gt;
	| _DIM&lt;br /&gt;
	| _ENUM&lt;br /&gt;
	| _MAP&lt;br /&gt;
	| _STRUCTURE&lt;br /&gt;
	| _SEQUENCE&lt;br /&gt;
	| _VALUE&lt;br /&gt;
	| _ATTRIBUTE&lt;br /&gt;
	| _OTHERXML&lt;br /&gt;
	| _CHAR&lt;br /&gt;
	| _BYTE&lt;br /&gt;
	| _INT8&lt;br /&gt;
	| _UINT8&lt;br /&gt;
	| _INT16&lt;br /&gt;
	| _UINT16&lt;br /&gt;
	| _INT32&lt;br /&gt;
	| _UINT32&lt;br /&gt;
	| _INT64&lt;br /&gt;
	| _UINT64&lt;br /&gt;
	| _FLOAT32&lt;br /&gt;
	| _FLOAT64&lt;br /&gt;
	| _STRING&lt;br /&gt;
	| _URL&lt;br /&gt;
	| _OPAQUE&lt;br /&gt;
	;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar===&lt;br /&gt;
The above Bison grammar assumes a corresponding lexer&lt;br /&gt;
that will return a set of token types (listed below).&lt;br /&gt;
The token with a trailing underscore represents an opening XML element&lt;br /&gt;
and a token with a leading underscore represents a closing XML element.&lt;br /&gt;
So, for example, token &#039;&#039;DATASET_&#039;&#039; is &#039;&#039;&amp;amp;lt;Dataset&amp;amp;gt;&#039;&#039;&lt;br /&gt;
and token &#039;&#039;_DATASET&#039;&#039; is &#039;&#039;&amp;amp;lt;/Dataset&amp;amp;gt;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
/* XML Element Names */&lt;br /&gt;
%token DATASET_ _DATASET&lt;br /&gt;
%token GROUP_ _GROUP&lt;br /&gt;
%token ENUMERATION_ _ENUMERATION&lt;br /&gt;
%token ENUMCONST_ _ENUMCONST&lt;br /&gt;
%token NAMESPACE_ _NAMESPACE&lt;br /&gt;
%token DIMENSION_ _DIMENSION&lt;br /&gt;
%token DIM_ _DIM&lt;br /&gt;
%token MAP_ _MAP&lt;br /&gt;
%token STRUCTURE_ _STRUCTURE&lt;br /&gt;
%token SEQUENCE_ _SEQUENCE&lt;br /&gt;
%token VALUE_ _VALUE&lt;br /&gt;
%token ATTRIBUTE_ _ATTRIBUTE&lt;br /&gt;
%token OTHERXML_ _OTHERXML&lt;br /&gt;
%token ERROR_ _ERROR&lt;br /&gt;
%token MESSAGE_ _MESSAGE&lt;br /&gt;
%token CONTEXT_ _CONTEXT&lt;br /&gt;
%token OTHERINFO_ _OTHERINFO&lt;br /&gt;
&lt;br /&gt;
/* XML Element Names for Atomic Types*/&lt;br /&gt;
%token CHAR_ _CHAR&lt;br /&gt;
%token BYTE_ _BYTE&lt;br /&gt;
%token INT8_ _INT8&lt;br /&gt;
%token UINT8_ _UINT8&lt;br /&gt;
%token INT16_ _INT16&lt;br /&gt;
%token UINT16_ _UINT16&lt;br /&gt;
%token INT32_ _INT32&lt;br /&gt;
%token UINT32_ _UINT32&lt;br /&gt;
%token INT64_ _INT64&lt;br /&gt;
%token UINT64_ _UINT64&lt;br /&gt;
%token FLOAT32_ _FLOAT32&lt;br /&gt;
%token FLOAT64_ _FLOAT64&lt;br /&gt;
%token STRING_ _STRING&lt;br /&gt;
%token URL_ _URL&lt;br /&gt;
%token OPAQUE_ _OPAQUE&lt;br /&gt;
%token ENUM_ _ENUM&lt;br /&gt;
&lt;br /&gt;
/* XML Attribute Names */&lt;br /&gt;
%token ATTR_BASE ATTR_BASETYPE ATTR_DAPVERSION ATTR_DMRVERSION&lt;br /&gt;
%token ATTR_ENUM ATTR_HREF ATTR_NAME ATTR_NAMESPACE&lt;br /&gt;
%token ATTR_NS ATTR_SIZE ATTR_TYPE ATTR_VALUE &lt;br /&gt;
%token ATTR_HTTPCODE&lt;br /&gt;
&lt;br /&gt;
/* Arbitrary XML Text */&lt;br /&gt;
%token TEXT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix 5. LALR(1) Grammar for Constraints using Bison Notation==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bnf&amp;quot;&amp;gt;&lt;br /&gt;
%start constraint&lt;br /&gt;
%%&lt;br /&gt;
constraint:&lt;br /&gt;
	dimredeflist&lt;br /&gt;
	clauselist&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredeflist:&lt;br /&gt;
          %empty&lt;br /&gt;
        | dimredeflist &#039;;&#039; dimredef&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clauselist:&lt;br /&gt;
          clause&lt;br /&gt;
        | clauselist &#039;;&#039; clause&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
clause:&lt;br /&gt;
          projection&lt;br /&gt;
	| selection&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
projection:&lt;br /&gt;
	segmenttree&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmenttree:&lt;br /&gt;
          segment&lt;br /&gt;
        | segmenttree &#039;.&#039; segment&lt;br /&gt;
        | segmenttree &#039;.&#039; &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        | segmenttree &#039;{&#039; segmentforest &#039;}&#039;&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
segmentforest:&lt;br /&gt;
	  segmenttree&lt;br /&gt;
	| segmentforest &#039;,&#039; segmenttree&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
segment:&lt;br /&gt;
          NAME&lt;br /&gt;
        | NAME slicelist&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slicelist: &lt;br /&gt;
          slice&lt;br /&gt;
        | slicelist slice&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
slice:&lt;br /&gt;
          &#039;[&#039; &#039;]&#039;&lt;br /&gt;
        | &#039;[&#039; subsetlist &#039;]&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
subsetlist:&lt;br /&gt;
	  subset&lt;br /&gt;
	| subsetlist &#039;,&#039; subset&lt;br /&gt;
	;&lt;br /&gt;
	&lt;br /&gt;
subset:&lt;br /&gt;
           index &lt;br /&gt;
        |  index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; index &lt;br /&gt;
        |  index &#039;:&#039; &lt;br /&gt;
        |  index &#039;:&#039; index &#039;:&#039; &lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
index:  INTEGER ;&lt;br /&gt;
&lt;br /&gt;
selection:&lt;br /&gt;
        segmenttree &#039;|&#039; filter&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
filter:&lt;br /&gt;
          predicate&lt;br /&gt;
        | predicate &#039;,&#039; predicate  /* &#039;,&#039; == AND */&lt;br /&gt;
        | &#039;!&#039; predicate %prec NOT&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
predicate:&lt;br /&gt;
          primary relop primary&lt;br /&gt;
        | primary relop primary relop primary&lt;br /&gt;
        | primary eqop primary&lt;br /&gt;
        ;&lt;br /&gt;
&lt;br /&gt;
relop:&lt;br /&gt;
	  &#039;&amp;amp;lt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;gt;&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;&amp;amp;lt;&#039;&lt;br /&gt;
	| &#039;^gt;&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
eqop:&lt;br /&gt;
	  &#039;=&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;!&#039; &#039;=&#039;&lt;br /&gt;
	| &#039;~&#039; &#039;=&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
primary:&lt;br /&gt;
          fieldname&lt;br /&gt;
        | constant&lt;br /&gt;
        | &#039;(&#039; predicate &#039;)&#039;&lt;br /&gt;
	;&lt;br /&gt;
&lt;br /&gt;
dimredef: NAME &#039;=&#039; slice ;&lt;br /&gt;
&lt;br /&gt;
fieldname: NAME&lt;br /&gt;
&lt;br /&gt;
constant: STRING | INTEGER | DOUBLE | BOOLEAN ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lexical Tokens for Bison Grammar for Constraints===&lt;br /&gt;
&lt;br /&gt;
The primary lexical tokens for constraints are:&lt;br /&gt;
NAME, STRING, INTEGER, DOUBLE, BOOLEAN.&lt;br /&gt;
&lt;br /&gt;
These lexemes are intended to match the patterns defined for the RELAX NG grammar.&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_2&amp;diff=10559</id>
		<title>DAP4: Specification Volume 2</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_2&amp;diff=10559"/>
		<updated>2014-07-04T03:06:12Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 2: DAP4 Web Services&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;November 6, 2013&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;04 July 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2014 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;While Volume 1 of the DAP4 specification addresses the detailed semantics and structure of the DAP4 data and metadata content, this volume (Volume 2) details the manner in which clients can request things from a DAP4 server and what things the clients can expect to receive from a DAP4 server in response to their requests. The description of this interaction focuses on DAP4 clients and servers that are communicating via HTTP, and while this is perceived by the authors as the most common transport for DAP4 client/server interaction the specification is written in a broad enough manner to allow for other transport mechanisms.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2013.09.06:&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;ASCII/.ascii changed to text/.txt; Removed most of the async text since it is duplicate of the material in the extension; Created a volume 3 containing the extensions&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document defines the DAP4 Web Service protocol which DAP4-compliant software MUST support when utilizing the HTTP protocol to transmit DAP4 requests and responses, along with additional optional services that DAP4-compliant software SHOULD support.&lt;br /&gt;
&lt;br /&gt;
The DAP4 protocol uses three basic responses to represent a data resource.  One response, the Dataset Metadata Response (DMR) contains metadata information describing the structure of the data resource. That is, it characterizes the variables, their datatypes, names and attributes. The second response, the Data Response (DataDMR), contains both the metadata about the requested data and the actual data that was requested. The third basic response is the Dataset Services Response (DSR) that provides a listing of services, any alternate media representations if available, and all of the associated access URI&#039;s for a particular data resource.&lt;br /&gt;
&lt;br /&gt;
The DAP4 protocol uses a fourth basic resource, the Constraint/Query Expression (CE), to represent subsetting of and, possibly, transformations of the dataset requested.&lt;br /&gt;
&lt;br /&gt;
The DAP4 protocol uses a fifth basic resource, the Error Response (ER), to allow servers to communicate error information with clients. When a request for any of the three basic responses cannot be completed, an Error response is returned. If an error occurs before the standard response is initiated, an error response is returned in place of the standard response. If an error occurs after a data response has been initiated, an Error Response is returned as the final chunked record as described in Section 7 &amp;quot;DAP4 Chunked Data Representation&amp;quot; of the DAP4 Data Model document.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1 |DAP4 Vol.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAP4 Data Model, constraint/query language, dataset metadata XML encoding, and binary data encoding are all defined in the DAP4 Volume 1: &amp;quot;Data Model, Persistent Representations, and Constraints&amp;quot; document.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1 |DAP4 Vol.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each of the three responses (Dataset Metadata, Data, and Dataset Services) are complete in and of themselves so that, for example, the Data response can be used by a client without ever requesting either of the two other responses. In many cases, client programs will request the Dataset Metadata response before requesting the Data response but there is no requirement they do so and servers SHALL NOT require that behavior on the part of clients.&lt;br /&gt;
&lt;br /&gt;
These three standard dataset responses can each be accessed in two different ways. First, similar to DAP2 URL construction and to support client-driven content negotiation (see the section titled [[#Content_Negotiation_and_Media_Types|&amp;quot;HTTP - Content Negotiation and Media Types&amp;quot;]] below), each dataset resource has a standard URL suffix that can be added to the DAP4 dataset URL to retrieve the resource in its standard (normative) encoding. This allows clients, given a base DAP4 dataset URL, to construct DAP4 URLs in a simple and standard way for each of the three standard dataset resources.&lt;br /&gt;
&lt;br /&gt;
Second, to support server-driven content negotiation (see the [[#Content_Negotiation_and_Media_Types|&amp;quot;HTTP - Content Negotiation and Media Types&amp;quot;]] section below) and hypermedia-driven style, a DAP4 resource role is defined for each standard dataset resource and a DAP4 media type is defined for each dataset resource encoding scheme.&lt;br /&gt;
&lt;br /&gt;
Any particular instance of a DAP4 server MAY have one or more additional services, alternate media representations of service responses, or unique (to the server instance) server side functions. All of these things, including the core services and their default representations MUST be included in the &#039;&#039;Dataset Services Response&#039;&#039;.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_DSR|DAP4 DSR]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAP4 web service is currently limited to HTTP GET requests though it is expected that extensions (e.g., asynchronous access) will use other HTTP methods (e.g., POST). This makes, for now, the DAP4 Constraint Expression something of a pseudo-resource type given that they are encoded as part of the URL query string rather than as an independent document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Terms_and_Definitions&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
== Terms and Definitions ==&lt;br /&gt;
&lt;br /&gt;
; Dataset Service Response (DSR)&lt;br /&gt;
: The DAP4 response type that contains a list of DAP (and other) services available for the dataset including any alternate media representations and all the associated access URIs.&lt;br /&gt;
; Dataset Metadata Response (DMR)&lt;br /&gt;
: The DAP4 response type that contains metadata information describing the structure of the requested data. The metadata information characterizes the requested data variables including their names, data types, shapes, and attributes.&lt;br /&gt;
; Dataset Data Response (Data)&lt;br /&gt;
: The DAP4 response type that contains both the dataset metadata and the binary data for the requested data.&lt;br /&gt;
; Resource role ID&lt;br /&gt;
: A URI that identifies the role of a resource, generally provided with a link to allow clients to identify the type of resource the link references. (For instance, an &amp;quot;atom:link&amp;quot; element has an optional &amp;quot;atom:rel&amp;quot; attribute.)&lt;br /&gt;
; Media Type&lt;br /&gt;
: A internet media type is a two-part identifier for resource encoding schemes, e.g. &amp;quot;text/html&amp;quot;, &amp;quot;text/plain&amp;quot;, &amp;quot;application/octet-stream&amp;quot;. (See [[#MediaTypes|section 1.1 DAP4 Resource Roles and Media Types]] of this document)&lt;br /&gt;
; DAP4 Constraint Expression (CE)&lt;br /&gt;
: The constraint expression that encapsulates various sub-setting of,  and possibly the application of server side functions to variables in a DAP4 dataset.&lt;br /&gt;
; Query String (QS)&lt;br /&gt;
: Everything after the &amp;quot;&amp;lt;font size=&amp;quot;3&amp;quot;&amp;gt;&amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;quot; character in a URL.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DAP4_MediaTypes&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
=== DAP4 Resource Roles and Media Types ===&lt;br /&gt;
&lt;br /&gt;
The standard DAP4 dataset resource roles and encodings (plus a few alternate encodings) that are defined in the core DAP4 documents are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dataset Services Response (DSR)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Resource Role&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/dataset-service&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 15%&amp;quot; | URL Suffix&lt;br /&gt;
! style=&amp;quot;width: 55%&amp;quot; | Media Type&lt;br /&gt;
! style=&amp;quot;width: 30%&amp;quot; | URL Example&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;none&#039;&#039; or &amp;quot;&#039;&#039;&#039;.dsr&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; application/vnd.opendap.dap4.dataset-services+xml&lt;br /&gt;
: Normative DSR encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dsr&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;.dsr.xml&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/xml&lt;br /&gt;
: Normative DSR encoding with generic media type&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.xml&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dsr.xml&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;&#039;.dsr.html&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/html&lt;br /&gt;
: HTML DSR encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.html&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dsr.html&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dataset Metadata Response (DMR)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Resource Role&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/dataset-metadata&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 15%&amp;quot; | URL Suffix&lt;br /&gt;
! style=&amp;quot;width: 55%&amp;quot; | Media Type&lt;br /&gt;
! style=&amp;quot;width: 30%&amp;quot; | URL Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dmr&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; application/vnd.opendap.dap4.dataset-metadata+xml&lt;br /&gt;
: Normative DMR encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dmr&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dmr.xml&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/xml&lt;br /&gt;
: Normative DMR encoding with generic media type&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dmr.xml&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dmr.html&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/html&lt;br /&gt;
: HTML DMR encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dsr.html&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dataset Data Response (Data)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Resource Role&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/data&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 15%&amp;quot; | URL Suffix&lt;br /&gt;
! style=&amp;quot;width: 55%&amp;quot; | Media Type&lt;br /&gt;
! style=&amp;quot;width: 30%&amp;quot; | URL Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dap&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; application/vnd.opendap.dap4.data&lt;br /&gt;
: Normative Data encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dap&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dap.txt&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/plain&lt;br /&gt;
: Text (UTF-8) Data encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dap.txt&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;&#039;&#039;&#039;.dap.xml&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
; text/xml&lt;br /&gt;
: XML Data encoding&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;http://server/path/dataset.nc&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.dap.xml&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Error Response (ER)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Resource Role&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/error&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 95%;&amp;quot; width=&amp;quot;90%&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 15%&amp;quot; | URL Suffix&lt;br /&gt;
! style=&amp;quot;width: 55%&amp;quot; | Media Type&lt;br /&gt;
! style=&amp;quot;width: 30%&amp;quot; | URL Example&lt;br /&gt;
|-&lt;br /&gt;
| N/A&lt;br /&gt;
|&lt;br /&gt;
; application/vnd.opendap.dap4.error+xml&lt;br /&gt;
: Normative Error encoding&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
| N/A&lt;br /&gt;
|&lt;br /&gt;
; text/xml&lt;br /&gt;
: Normative Error encoding with generic media type&lt;br /&gt;
| N/A&lt;br /&gt;
|-&lt;br /&gt;
| N/A&lt;br /&gt;
|&lt;br /&gt;
; text/html&lt;br /&gt;
: HTML Error encoding&lt;br /&gt;
| N/A&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Core Specification Documents ===&lt;br /&gt;
&lt;br /&gt;
* DAP4 Volume 1: &amp;quot;Data Model, Persistence Representations, and Constraints&amp;quot;&lt;br /&gt;
* DAP4 Web Service (this document)&lt;br /&gt;
* DAP4 Dataset Services&lt;br /&gt;
* DAP4 Requirements for Server-side Functions&lt;br /&gt;
&lt;br /&gt;
=== Extensions to DAP4 Core Specifications ===&lt;br /&gt;
&lt;br /&gt;
Several types of extensions can be made to the DAP4 core including:&lt;br /&gt;
&lt;br /&gt;
* New encodings for the core DAP4 response types&lt;br /&gt;
* New response types&lt;br /&gt;
* New server-side functions.&lt;br /&gt;
&lt;br /&gt;
==  DAP4 Web Service Responses  == &lt;br /&gt;
&lt;br /&gt;
The core of the DAP4 Web Service protocol consists of the four standard response types: Dataset Services Response (DSR), Dataset Metadata Response (DMR),  Dataset Data Response (Data), DAP4 Error Response (Error)&lt;br /&gt;
&amp;lt;!--, and the DAP4 Asynchronous Response (Async).--&amp;gt;&lt;br /&gt;
Each dataset served by a DAP4 compliant server MUST provide the DSR, DMR, and Data responses and MUST return errors documents as DAP4 Error Responses.&lt;br /&gt;
&amp;lt;!--A DAP4 server MAY return an DAP4 Asynchronous Response for data that are not immediately available. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async|DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All of the example requests described below are based on the DAP4 dataset URL:&lt;br /&gt;
: http://server.org:8080/dap/path/data.nc&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Dataset Services Response ===&lt;br /&gt;
&lt;br /&gt;
The DAP4 Dataset Services Response (DSR)&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_DSR|DAP4 DSR]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; provides clients with a listing of all available DAP4 services and all the available encodings for those services as well as all available DAP4 extensions.&lt;br /&gt;
&lt;br /&gt;
Each service (or response type) has a unique resource role (defined in the appropriate specification), each link (alternate representation) for a given service MUST fulfill that same role. This is not always a clear distinction to make. For example, the DAP4 Dataset Metadata Response can be mapped into ISO 19115 metadata. However, IS0 19115 is clearly a different domain.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Dataset Services Response MUST contain the following information:&lt;br /&gt;
&lt;br /&gt;
* List of DAP versions supported by server&lt;br /&gt;
* The implementation version (e.g., &amp;quot;TDS 4.3.57&amp;quot; or &amp;quot;Hyrax 1.7.45&amp;quot;)&lt;br /&gt;
* List of all available DAP4 services for the dataset&lt;br /&gt;
* For each DAP4 services listed, a list of all available links each with its corresponding media type&lt;br /&gt;
* List of supported extensions&lt;br /&gt;
** Resource type extensions&lt;br /&gt;
** Media type extensions&lt;br /&gt;
** Server-side function extensions&lt;br /&gt;
&lt;br /&gt;
If SHOULD contain the following information:&lt;br /&gt;
&lt;br /&gt;
* A human readable title for the dataset&lt;br /&gt;
* A human readable title for each service&lt;br /&gt;
&lt;br /&gt;
To take advantage of web caching, servers should try to keep DSRs light weight (i.e., quick creation) and as stable as possible.&lt;br /&gt;
&lt;br /&gt;
==== DSR Resource Role ====&lt;br /&gt;
&lt;br /&gt;
DSRs are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/dataset-services&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Normative Encoding of the DSR ====&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Dataset Services Response is defined in the &amp;quot;Normative XML Encoding of the DSR&amp;quot; appendix. The media type for the normative XML representation is&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dataset-services+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Service Behavior ====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a base DAP4 dataset URL, all DAP4 servers MUST return the normative XML encoding of the DSR given these conditions: &lt;br /&gt;
&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header contains only the normative XML encoding media type,&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header equals &amp;quot;*/*&amp;quot;, or&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header does not indicate a preference for another media type in which the server knows how to encode the DSR.&lt;br /&gt;
&lt;br /&gt;
For example, the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: application/vnd.opendap.dataset-services+xml&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Downgrading the Normative XML Encoding (Required) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a base DAP dataset URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url&#039;&#039;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the response MUST be the normative representation of the DSR along with the HTTP &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;Content-Type&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header set to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;text/xml&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; . For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.xml HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/xml; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The normative XML representation MUST also be returned when an HTTP GET request is made on a base DAP4 dataset URL (without a suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an HTML encoded DSR. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Other Encodings of the DSR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== HTML Encoding  (Optional) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a base DAP dataset URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url&#039;&#039;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with an HTML representation of the DSR, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 to indicate that an HTML representation of the DSR is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.html HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/html; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;If available, the HTML representation MUST also be returned when an HTTP GET request is made on a base DAP4 dataset URL (without a suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an HTML encoded DSR. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/html&lt;br /&gt;
&amp;lt;/pre&amp;gt;Must return the HTML representation of the DMR, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
=== [[DAP4 Dataset Services Response]] (Original) ===&lt;br /&gt;
&lt;br /&gt;
The DAP4 Dataset Services Response (DSR) provides a listing of the various DAP4 resources and their associated media-type representations available for a dataset. Dereferencing the base URL for a dataset accessed through a DAP4 web server will return a &#039;&#039;DatasetServices&#039;&#039; document that describes the various responses possible for that data set, including URLs that can be used to access those responses. In other words, the Dataset Services response is acquired by dereferencing the data resource (aka base) URL for the dataset and there is no suffix added to the data resource URL prior to that dereferencing.&lt;br /&gt;
&lt;br /&gt;
Every DAP4 compliant server MUST return the normative representation (an XML document [[DAP4 Dataset Services Response | as described here]]) of the Dataset Services response when a client attempts to access an unmodified dataset URL. The DAP4 server MAY return alternate representations if the client indicates that it can accept them and the server can provide them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More information on the normative XML representation for the Dataset Services Response can be found on the [[DAP4 Dataset Services Response]] page.&lt;br /&gt;
&lt;br /&gt;
service suffix = &amp;lt;br /&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/dataset-services#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DAP4 media type:&lt;br /&gt;
*&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dataset-services+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternate media type(s):&lt;br /&gt;
*&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
:media type suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
:url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url&#039;&#039;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
:media type suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
:url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url&#039;&#039;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== HTTP Request Examples ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Simple&#039;&#039;&lt;br /&gt;
: This simple request will return the normative XML representation of the Dataset Web Services response with the &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;Content-Type&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header of the response set to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dataset-services+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Server-driven content negotiation for the HTML representation.&#039;&#039;&lt;br /&gt;
: This request for the Dataset Services response indicates that the client wants the HTML representation. The server SHOULD reply with the HTML representation if it is available, otherwise it MAY return it&#039;s normative XML representation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Server-driven content negotiation for the XML representation.&#039;&#039;&lt;br /&gt;
: This request for the the Dataset Services response indicates that the client wants the XML representation. The server MUST reply with the XML representation, and the server should set the &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;Content-Type&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;. While the normative representation of the the Dataset Services response is already an XML document, the normative media type is &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dataset-services+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; which may be unfamiliar to many generic clients (such as web browsers) and it is quite conceivable that such a client might ask for the more generic  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; media type.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Agent-driven content negotiation for the HTML representation.&#039;&#039;&lt;br /&gt;
: This request is for the HTML version of Dataset Services response. The server MUST reply with the HTML representation (with the &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;Content-Type&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header of the response set to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;) if available, or with a status of 404 if not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.html HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Agent-driven content negotiation for the XML representation.&#039;&#039;&lt;br /&gt;
: This request is for the XML version of Dataset Services response. The server MUST response with the XML representation (with the &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;Content-Type&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header of the response set to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;) if available, or with a status of 404 if not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.xml HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  Dataset Metadata Response  ===&lt;br /&gt;
The Dataset Metadata Service returns the Dataset Metadata Response (DMR) which is a metadata description of the dataset. The normative representation of the DMR  is an XML document that contains both the &#039;syntactic&#039; (structural) and &#039;semantic&#039; metadata for the dataset, persisted as a DAP4 data model representation of the dataset held at the server.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; The DMR service accepts a query string (constraint expression) that allows you to inspect the effects on the data structures when sub-setting and/or server side functions are applied. If a constraint expression has been successfully applied, the service will returned the constrained view of the dap:Dataset object. The constrained view may contain different data structures than the unconstrained view as the constraint may alter the reasonable representation of the data set.&lt;br /&gt;
Note that all dap:Attribute objects have been removed from constrained dap:Dataset objects. More information on the syntax of DAP4 constraint expressions can be found in Volume 1 of the DAP4 specification. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DMR Resource Role ====&lt;br /&gt;
&lt;br /&gt;
DMRs are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/dataset-metadata&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Normative Encoding of the DMR ====&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Dataset Metadata Response is defined in Volume 1 of the DAP4 specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;  The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.dataset-metadata+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Service Behavior ====&lt;br /&gt;
&lt;br /&gt;
Every DAP4 compliant server MUST return the normative representation of the Dataset Metadata Response  (an XML document described Volume 1 of the DAP4 specification  &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;) when a client attempts to access a dataset URL with the suffix &amp;quot;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dmr&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;quot; appended to it. The DAP4 server MAY return alternate representations if the client indicates that it can accept them and the server can provide them.&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a base DAP dataset URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dmr&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.dmr&#039;&#039;&#039;&#039;+ [?dap_constraint]&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with an normative representation of the DMR for the (possibly constrained) dataset given these conditions:&lt;br /&gt;
&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header contains only the normative XML encoding media type (&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.dataset-metadata+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;),&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header equals &amp;quot;*/*&amp;quot;, or&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header does not indicate a preference for another media type in which the server knows how to encode the DMR.&lt;br /&gt;
&lt;br /&gt;
For example, the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dmr HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: application/vnd.opendap.dataset-metadata+xml&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Downgrading the Normative XML Encoding (Required) =====&lt;br /&gt;
While the normative representation of the the Dataset Metadata response is already an XML document, the normative media type is &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dataset-metadata+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; which may be unfamiliar to many generic clients (such as web browsers) and it is quite conceivable that such a client might ask for the more generic  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; media type.&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a DAP DMR URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dmr&#039;&#039;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the response MUST be the normative representation of the DMR along with the HTTP &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;Content-Type&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; header set to &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;text/xml&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; . For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dmr.xml HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/xml; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;The normative XML representation of the DMR MUST also be returned when an HTTP GET request is made on a base DAP4 DMR URL ( and the server uses server-driven content negotiation to decide that the best response for the client would be an HTML encoded DSR. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dmr HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Other Encodings of the DMR ====&lt;br /&gt;
&lt;br /&gt;
===== HTML Encoding  (Optional) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a DAP DMR URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dmr&#039;&#039;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with an HTML representation of the DMR, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 (or 415)  to indicate that an HTML representation of the DMR is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dmr.html HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/html; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;If available, the HTML representation MUST also be returned when an HTTP GET request is made on a base DAP4 DMR URL (without an additional suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an HTML encoded DMR. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dmr HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/html&lt;br /&gt;
&amp;lt;/pre&amp;gt;Must return the HTML representation of the DMR, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&lt;br /&gt;
=== DAP4: Data Response &amp;lt;!--&#039;&#039;&#039;[[DAP4:_Responses#Data_Response | DAP4: Data Response ]]&#039;&#039;&#039;--&amp;gt; ===&lt;br /&gt;
The Data Service provides DAP4 data access to a dataset, and is the (primary) way that DAP4 returns data to a client.  The Data service accepts a query string (constraint expression) which allows you to subset the data and invoke server side functions. When the service is invoked it returns the DAP4 data object. On the wire this is a binary document with MIME type &#039;&#039;application/vnd.opendap.dap4.data&#039;&#039;. The payload is broken into two logical parts: A DMR-type xml document that describes the data and a BLOB that contains the actual data. For more on the information on the Data response and the internal structure of its payload along with a complete discussion of the DAP4 constraint expression syntax see Volume 1 of the DAP4 specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Data Response Resource Role ====&lt;br /&gt;
&lt;br /&gt;
DAP4 Data Responses are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/data&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Normative Encoding of the Data Response ====&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Data Response is defined in Volume 1 of the DAP4 specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;  The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.data&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Service Behavior ====&lt;br /&gt;
Every DAP4 compliant server MUST return the normative representation of the Data Response when a client attempts to access a dataset URL with the suffix &amp;quot;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dap&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;quot; appended to it. The DAP4 server MAY return alternate representations if the client indicates that it can accept them and the server can provide them. The normative representation of the Data Response is described in Volume 1 of the DAP4 specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1|DAP4_Vol1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a base DAP dataset URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dap&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.dap&#039;&#039;&#039;&#039;+ [?dap_constraint]&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with an normative representation of the (possibly constrained) data response for the dataset given these conditions:&lt;br /&gt;
&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header contains only the normative XML encoding media type (&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.data&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;),&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header equals &amp;quot;*/*&amp;quot;, or&lt;br /&gt;
* the request &amp;quot;Accept&amp;quot; header does not indicate a preference for another media type in which the server knows how to encode the Data Response.&lt;br /&gt;
&lt;br /&gt;
For example, the request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: application/vnd.opendap.data&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other Encodings of the Data Response ====&lt;br /&gt;
&lt;br /&gt;
===== Text Encoding  (Optional) =====&lt;br /&gt;
When an HTTP GET request is made on a DAP Data Response URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.txt&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dap&#039;&#039;&#039;&#039;&#039;.txt&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with the text representation of the Data Response using the utf-8 character set, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 (or 415) to indicate that a text representation of the Data Response is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap.txt HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/plain; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;If available, the text representation MUST also be returned when an HTTP GET request is made on a base DAP4 Data Response URL (without an additional suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an text encoded Data Response. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/plain&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Must return the text representation of the Data Response, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&lt;br /&gt;
===== XML Encoding  (Optional) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a DAP Data Response URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dap&#039;&#039;&#039;&#039;&#039;.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with the XML representation of the Data Response, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 (or 415) to indicate that an XML representation of the Data Response is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap.xml HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;Might result in the following response:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: text/xml; charset=utf-8&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If available, the XML representation MUST also be returned when an HTTP GET request is made on a base DAP4 Data Response URL (without an additional suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an XML encoded data response. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: text/xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Must return the XML representation of the Data Response, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&lt;br /&gt;
===== NetCDF-3 Encoding  (Optional) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a DAP Data Response URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.nc&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dap&#039;&#039;&#039;&#039;&#039;.nc&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with a NetCDF-3 representation of the Data Response, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 (or 415) to indicate that a NetCDF-3 representation of the Data Response is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Might result in the following response:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: application/x-netcdf&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If available, the NetCDF-3 representation MUST also be returned when an HTTP GET request is made on a base DAP4 Data Response URL (without an additional suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an NetCDF-3 encoded data response. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: application/x-netcdf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Must return the NetCDF-3 representation of the Data Response, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&lt;br /&gt;
===== NetCDF-4 Encoding  (Optional) =====&lt;br /&gt;
&lt;br /&gt;
When an HTTP GET request is made on a DAP Data Response URL with the suffix &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.nc4&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt; added to it:&lt;br /&gt;
&lt;br /&gt;
: request url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;dataset_url.dap&#039;&#039;&#039;&#039;&#039;.nc4&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server MUST reply with a NetCDF-4 representation of the Data Response, &#039;&#039;&#039;or&#039;&#039;&#039; return an HTTP status of 404 (or 415) to indicate that a NetCDF-4 representation of the Data Response is not available. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap.nc HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: */*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Might result in the following response:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Content-Type: application/x-netcdf;ver=4&lt;br /&gt;
Date: ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If available, the NetCDF-4 representation MUST also be returned when an HTTP GET request is made on a base DAP4 Data Response URL (without an additional suffix) and the server uses server-driven content negotiation to decide that the best response for the client would be an NetCDF-4 encoded data response. For example this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap HTTP/1.1&lt;br /&gt;
Host: server.org:8080&lt;br /&gt;
Accept: application/x-netcdf;ver=4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Must return the NetCDF-4 representation of the Data Response, if available. If no such representation is available then the server MAY return an HTTP status of 404 or even 415.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== DAP4 Asynchronous Response ===&lt;br /&gt;
&lt;br /&gt;
Some servers may not be able to fulfill DAP4 service requests in a timely manner. &lt;br /&gt;
* A  DAP4 server that is retrieving data content from a near-line tape storage subsystem might take several minutes to access a particular data holding. &lt;br /&gt;
* A DAP4 server that is providing access to data held in an Amazon Web Services Glacier Vault will have to wait ~4 hours before it can retrieve a particular holding. &lt;br /&gt;
In these circumstances the server may return the DAP4 Asynchronous Response &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async | DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Asynchronous Response Resource Role ====&lt;br /&gt;
&lt;br /&gt;
DAP4 Asynchronous Responses are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/async&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Normative Encoding of the Asynchronous Response ====&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Asynchronous Response is defined in Appendix x &amp;quot;Normative XML Encoding of the Asynchronous Response&amp;quot;. The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.async.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[DAP4 Error Response]]  ===&lt;br /&gt;
&lt;br /&gt;
The DAP4 protocol returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Error Response is defined by the following RELAX-NG schema.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;grammar xmlns=&amp;quot;http://relaxng.org/ns/structure/1.0&amp;quot;&lt;br /&gt;
                xmlns:doc=&amp;quot;http://www.example.com/annotation&amp;quot;&lt;br /&gt;
                datatypeLibrary=&amp;quot;http://xml.opendap.org/datatypes/dap4&amp;quot;&lt;br /&gt;
                ns=&amp;quot;http://xml.opendap.org/ns/DAP/4.0#&amp;quot;&lt;br /&gt;
                &amp;gt;&lt;br /&gt;
&amp;lt;start&amp;gt;&lt;br /&gt;
  &amp;lt;ref name=&amp;quot;errorresponse&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/start&amp;gt;&lt;br /&gt;
&amp;lt;define name=&amp;quot;errorresponse&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;element name=&amp;quot;Error&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;httpcode&amp;quot;&amp;gt;&amp;lt;data type=&amp;quot;dap4_integer&amp;quot;/&amp;gt;&amp;lt;/attribute&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
    &amp;lt;optional&amp;gt;&lt;br /&gt;
      &amp;lt;interleave&amp;gt;&lt;br /&gt;
        &amp;lt;element name = &amp;quot;Message&amp;quot;&amp;gt;&amp;lt;text/&amp;gt;&amp;lt;/Message&amp;gt;&lt;br /&gt;
        &amp;lt;element name = &amp;quot;Context&amp;quot;&amp;gt;&amp;lt;text/&amp;gt;&amp;lt;/Message&amp;gt;&lt;br /&gt;
        &amp;lt;element name = &amp;quot;OtherInformation&amp;quot;&amp;gt;&amp;lt;text/&amp;gt;&amp;lt;/Message&amp;gt;&lt;br /&gt;
      &amp;lt;/interleave&amp;gt;&lt;br /&gt;
    &amp;lt;/optional&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/define&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Error element has one optional attribute: the &#039;&#039;httpcode&#039;&#039; which is a standard HTTP protocol return code indicating the general class of error. When possible, this code should match the return code in the HTTP headers for the response.&lt;br /&gt;
&lt;br /&gt;
The body of the &amp;amp;lt;Error&amp;amp;gt; element may contain any or all of the following&lt;br /&gt;
inner elements each containing arbitrary text.&lt;br /&gt;
# &amp;amp;lt;Message&amp;amp;gt; &amp;amp;mdash; A short informative message describing the error.&lt;br /&gt;
# &amp;amp;lt;Context&amp;amp;gt; &amp;amp;mdash; Information describing the context in which the error occurred: position of a parse error in a constraint expression, for example.&lt;br /&gt;
# &amp;amp;lt;OtherInformation&amp;amp;gt; &amp;amp;mdash; Arbitrary additional text information: a Java stack trace, for example.&lt;br /&gt;
&lt;br /&gt;
==== Error Response Resource Role ====&lt;br /&gt;
&lt;br /&gt;
DAP4 Error Responses are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/error&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Normative Encoding of the Error Response ====&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Error Response is defined in Appendix x &amp;quot;Normative XML Encoding of the Error Response&amp;quot;. The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.error.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== HTTP ==&lt;br /&gt;
&lt;br /&gt;
The DAP4 Web Services specification describes the features of HTTP that are required to be a compliant DAP4 client or server. It does not attempt to describe all aspects of HTTP that DAP4 servers might implement or that DAP4 clients may see in response to DAP4 requests. Similarly, it does not cover all issues related to the performance and scalability of HTTP.&lt;br /&gt;
&lt;br /&gt;
However, the following sections include both DAP4 requirements as well as some suggestions of HTTP features that servers and clients are encouraged to use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Content Negotiation and Media Types&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
=== Content Negotiation and Media Types ===&lt;br /&gt;
&lt;br /&gt;
Though the DAP4 core specifications only describe one encoding for each type of resource, DAP4 web servers MAY have the ability to provide a given resource in a number of different media types. All media types available for a resource MUST be listed in the DAP4 Dataset Services response document.&lt;br /&gt;
&lt;br /&gt;
DAP4 responses MUST use the &amp;quot;Content-Type&amp;quot; header field to identify the media type of the DAP4 response body. For example, the normative value for the XML encoded DMR response is &#039;&#039;application/vnd.opendap.dap4.dataset-metadata+xml&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The DAP4 Dataset Services response describes the available services and their media types, and through this description provides DAP4 software (client and/or server) with two different mechanisms to negotiate for different kinds of media representations. The first mechanism is server-driven content negotiation as described in the HTTP 1.1 specification, section 12, &amp;quot;Content Negotiation&amp;quot;.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_12 |HTTP RFC2616 - Section 12]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;  The second mechanism is similar to the agent-driven negotiation also described in section 12 of the HTTP 1.1 specification. The difference being that the &amp;quot;list of available representations ... [each with] its own URI&amp;quot; is provided by the DAP4 Dataset Services response rather than in response to an initial request. &lt;br /&gt;
&lt;br /&gt;
Clients need not retrieve the Dataset Services response in order to access the normative representations of either the Dataset Metadata or Data responses, as these responses are required for every DAP4 server and are mapped to well known URL patterns. If clients attempt to access other representations or other services using agent-driven negotiation without first checking the Dataset Services response, they should be prepared to receive a 404 Not Found response.&lt;br /&gt;
&lt;br /&gt;
When using server-driven negotiation, DAP4 clients are encouraged to, at a minimum, include &amp;quot;Accept&amp;quot;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_14.1 |HTTP RFC2616 - Section 14.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;and &amp;quot;User-Agent&amp;quot;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_14.43|HTTP RFC2616 - Section 14.43]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; headers in their requests and to provide accurate and detailed information in the values of those headers. However, when server-driven negotiation is used, DAP4 servers are not limited to those headers for determining the media type that is returned. DAP4 clients should also be prepared to handle 415 &amp;quot;Unsupported Media type&amp;quot; response codes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
When using server-driven negotiation DAP4 servers MAY return a more general media type (e.g., &amp;quot;text/xml&amp;quot;) if something in the request (e.g., the &amp;quot;Accept&amp;quot; or &amp;quot;User-Agent&amp;quot; header values) indicates the client might be better able to handle a more general media type. Servers should use caution when downgrading the response media type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
  It is impossible for the server to accurately determine what&lt;br /&gt;
  might be &amp;quot;best&amp;quot; for any given user, since that would require&lt;br /&gt;
  complete knowledge of both the capabilities of the user agent&lt;br /&gt;
  and the intended use for the response (e.g., does the user want&lt;br /&gt;
  to view it on screen or print it on paper?).&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
When DAP4 servers engage in server-driven content negotiation they SHOULD only return DAP4 media types to clients that explicitly request them, otherwise they should return the most general media type that correctly represents the response content. In particular if a DAP4 server detects that a general purpose web browser (such as Internet Explorer, Firefox, Chrome, Safari, Opera, etc.) is requesting one of the three DAP4 response types then the Content-Type header in the servers response SHOULD be the most widely understood media type for the particular response. For the Dataset Services response and Dataset Metadata response this would be a media type of &#039;&#039;text/xml&#039;&#039; and for the Data response it would be &#039;&#039;multipart/mixed&#039;&#039;. This is particularly important for the Dataset Services response and Dataset Metadata response as these XML documents may come with XSLT style sheet references that would allow the browser to transform the XML content into an HTML presentation suitable for the browsers. This presentation may even include a complete data request form that will allow the user to subset and select data in their browser. If the DAP4 specific media types are returned the browsers will simply write the response to disk and they will make no effort to render the response in the browser using the stylesheet reference.&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;   width=&amp;quot;85%&amp;quot;&lt;br /&gt;
|+ Server Driven Negotiation Debate (NEEDS RESOLVED)&lt;br /&gt;
! Ethan&#039;s View&lt;br /&gt;
! James&#039; View&lt;br /&gt;
|-&lt;br /&gt;
|When using server-driven negotiation DAP4 servers MAY return a more general media type (e.g., &amp;quot;text/xml&amp;quot;) if something in the request (e.g., the &amp;quot;Accept&amp;quot; or &amp;quot;User-Agent&amp;quot; header values) indicates the client might be better able to handle a more general media type. Servers should use caution when downgrading the response media type: &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;&#039;&#039;It is impossible for the server to accurately determine what might be &amp;quot;best&amp;quot; for any given user, since that would require complete knowledge of both the capabilities of the user agent and the intended use for the response (e.g., does the user want to view it on screen or print it on paper?).&#039;&#039;&amp;quot;&lt;br /&gt;
| style=&amp;quot;width: 50%;&amp;quot; | When DAP4 servers engage in server-driven content negotiation they SHOULD only return DAP4 media types to clients that explicitly request them, otherwise they should return the most general media type that correctly represents the response content. In particular if a DAP4 server detects that a general purpose web browser (such as Internet Explorer, Firefox, Chrome, Safari, Opera, etc.) is requesting one of the three DAP4 response types then the Content-Type header in the servers response SHOULD be the most widely understood media type for the particular response. For the Dataset Services response and Dataset Metadata response this would be a media type of &#039;&#039;text/xml&#039;&#039; and for the Data response it would be &#039;&#039;multipart/mixed&#039;&#039;. This is particularly important for the Dataset Services response and Dataset Metadata response as these XML documents may come with XSLT style sheet references that would allow the browser to transform the XML content into an HTML presentation suitable for the browsers. This presentation may even include a complete data request form that will allow the user to subset and select data in their browser. If the DAP4 specific media types are returned the browsers will simply write the response to disk and they will make no effort to render the response in the browser using the stylesheet reference.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
==== A brief digression on &#039;&#039;vnd&#039;&#039; MIME types ====&lt;br /&gt;
Looking at how web browsers use these types, the set of vendor MIME types appears to be driven by the browsers, and not the servers. For example, Chrome will look for a MIME type of &#039;&#039;application/vnd.google.drive.ext-type.png&#039;&#039; and do something special when it sees it. Unless we expect mass-market HTTP client software to recognize &#039;&#039;vnd.opendap...&#039;&#039; MIME types, there&#039;s little value in them. This conclusion matches what the developers in NASA came to conclude with respect to the vendor MIME types when used as values for the Content-Type header. It&#039;s certainly the case that these MIME types provide no value to DAP-aware clients. Providing responses with Content-Type of &#039;&#039;text/xml&#039;&#039; will result in a browser rendering the response, something we might make actually useful with some savvy coding (for example, the (in)famous web form interface could be encoded in it using an XSL transform).&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Redirects ===&lt;br /&gt;
&lt;br /&gt;
While HTTP redirects are not directly part of the DAP4 web protocol it is strongly suggested that DAP4 client implementations be capable of processing HTTP redirects as nominally described in the HTTP-1.1 specification sections on redirection status codes and redirection response headers.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616 |HTTP RFC2616]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.3 |HTTP RFC2616 - Section 10.3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616 - Section 14.30 |HTTP RFC2616 - Section 14.30]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; (It is suggested that implementers of DAP4 clients utilize an existing robust HTTP client library that will manage this for them.)&lt;br /&gt;
&lt;br /&gt;
=== Caching of Responses and Conditional Requests ===&lt;br /&gt;
&lt;br /&gt;
While, HTTP caching and conditional requests are not explicitly part of the DAP4 web protocol, they do provide important tools for improving the performance of both sides client server interaction. Therefore, it is strongly suggested that DAP4 servers and client implementers be aware of how HTTP caching &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616 - Section 13|HTTP RFC2616 - Section 13]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; works, and utilize it for working with DAP servers.&lt;br /&gt;
&lt;br /&gt;
=== Authentication/Authorization ===&lt;br /&gt;
&lt;br /&gt;
Authentication is the process by which a user agent establishes the identity of the user to a server, and the server establishes it&#039;s identity with the user agent. While, HTTP authentication is not explicitly part of the DAP4 web protocol, it does provide important tools for securing the client server interaction. Therefore, it is strongly suggested that DAP4 servers and client implementers be aware of how HTTP authentication works, and utilize it for working with DAP servers.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2617 |HTTP RFC2617]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; Server implementers should pay particular attention to HTTP security considerations.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_15|HTTP RFC2616 - Section 15]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorization is the process through which a server determines who/what has access to its various holdings and services. The HTTP protocol does not directly address the issue of authorization (even though HTTP defines the 401 response status using the word &amp;quot;authorization&amp;quot; it does not provide separate semantics for authentication and authorization which we see as an important distinction for data access), but any DAP4 server implementer should be aware that some kind of mechanism for controlling access to holdings and services will likely be desired by the people that install and operate their software.&lt;br /&gt;
&lt;br /&gt;
=== Headers ===&lt;br /&gt;
&lt;br /&gt;
==== Request Headers ====&lt;br /&gt;
&lt;br /&gt;
These are the HTTP request headers that DAP clients using HTTP MAY utilize. DAP4 servers MUST accept these headers and act on them in a manner consistent with their descriptions below.&lt;br /&gt;
&lt;br /&gt;
===== General =====&lt;br /&gt;
:; Accept&lt;br /&gt;
:: The HTTP Accept header MAY be used by clients that wish to engage in server-dirven content negotiation by requesting a particular representation of a resource in the initial request. The server MUST utilize this header, if present, in a manner consistent with the HTTP content negotiation]] specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_12 |HTTP RFC2616 - Section 12]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:; User-Agent&lt;br /&gt;
:: The HTTP User-Agent header MAY be used by clients to indicate their &amp;quot;software identity&amp;quot; to the server.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_14.43 |HTTP RFC2616 - Section 14.43]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; The server MAY utilize this header, if present, to alter the Content-Type of the response to something that is more likely to be digestible by the requesting client software.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_14.17 |HTTP RFC2616 - Section 14.17]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== DAP Specific =====&lt;br /&gt;
&lt;br /&gt;
:There are no DAP specific headers required to make a general DAP request.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
===== Asynchronous Transaction &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async |DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; =====&lt;br /&gt;
; X-DAP-Async-Accept &lt;br /&gt;
: A client MAY indicate it&#039;s willingness to accept asynchronous responses by including the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; HTTP header. Clients MAY make conditional requests for asynchronous responses by indicating the maximum time they are willing to wait by using the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; HTTP header with a value given in seconds. A value of zero indicates that the client is willing to accept whatever delay the server may encounter.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Response Headers ====&lt;br /&gt;
&lt;br /&gt;
These are the HTTP response headers that DAP servers using HTTP MUST and SHOULD (as indicated) return.&lt;br /&gt;
&lt;br /&gt;
===== General =====&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font size=&amp;quot;3&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt; Should we be referencing RFC1123 for the time format or the source (which RFC1123 references) [http://www.rfc-editor.org/rfc/rfc822.txt RFC822]? I think it&#039;s hard to find the time format stuff in either place and since RFC1123 basically says to use RFC822 then shouldn&#039;t we use RFC822? Or did I miss something in RFC1123 that amends the content of RFC822 w.r.t. format? Ethan??? [[User:Ndp|ndp]] 21:26, 7 November 2013 (PST))&amp;lt;/font&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
:; Date&lt;br /&gt;
:: DAP4 servers MUST return an HTTP &#039;&#039;&#039;Date&#039;&#039;&#039; header whose value is the time of the response and which MUST be in RFC 1123 date/time format.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#RFC1123|RFC1123]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:; Last-Modified&lt;br /&gt;
:: DAP4 servers SHOULD return an HTTP &#039;&#039;&#039;Last-Modified&#039;&#039;&#039; header whose value is the last modified time of the request resource and which MUST be in &amp;lt;nowiki&amp;gt;RFC  1123&amp;lt;/nowiki&amp;gt; date/time format.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#RFC1123|RFC1123]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:; Content-Type&lt;br /&gt;
:: DAP4 servers MUST return an HTTP &#039;&#039;&#039;Content-Type&#039;&#039;&#039; header, the value of which SHOULD be set in accordance with the Dap4 Resource Roles and Media Types discussion in section 1.1 of this document.&lt;br /&gt;
&lt;br /&gt;
:; Content-Description&lt;br /&gt;
:: DAP4 servers SHOULD return an HTTP &#039;&#039;&#039;Content-Description&#039;&#039;&#039; header. &lt;br /&gt;
&lt;br /&gt;
:; Content-Disposition&lt;br /&gt;
:: DAP4 servers SHOULD return an HTTP &#039;&#039;&#039;Content-Disposition&#039;&#039;&#039; header when transmitting file typed responses.&lt;br /&gt;
&lt;br /&gt;
:; Content-Encoding&lt;br /&gt;
:: DAP4 servers MUST return an HTTP &#039;&#039;&#039;Content-Encoding&#039;&#039;&#039; header when the content-coding of an entity is not &amp;quot;identity&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;Red&amp;quot;&amp;gt;Update this to include the following headers....&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
HTTP/1.1 200 OK&lt;br /&gt;
Date: Mon, 23 May 2005 22:38:34 GMT&lt;br /&gt;
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT&lt;br /&gt;
Content-Type: multipart/related; type=&amp;quot;text/xml&amp;quot;; start=&amp;quot;&amp;lt;&amp;lt;start id&amp;gt;&amp;gt;&amp;quot;;  boundary=&amp;quot;&amp;lt;&amp;lt;boundary&amp;gt;&amp;gt;&amp;quot;&lt;br /&gt;
Content-Description: data-ddx; url=...&lt;br /&gt;
Content-Encoding: gzip&lt;br /&gt;
XDAP: &amp;lt;&amp;lt;DAP version&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== DAP Specific =====&lt;br /&gt;
&lt;br /&gt;
:; X-DAP-Server&lt;br /&gt;
:: DAP4 servers SHOULD return the &#039;&#039;&#039;X-DAP-Server&#039;&#039;&#039; HTTP header. This HTTP header is used in a response to communicate the software version of the server. This may be a simple string with the server name and version number, or multiple software component versions may be represented. The value of this header is a string determined by the implementations author(s).&lt;br /&gt;
:: &#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
::: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP-Server: bes/3.10.0, libdap/3.11.2, dap-server/ascii/4.1.2, csv_handler/1.0.2, freeform_handler/3.8.4, fits_handler/1.0.7, fileout_netcdf/1.1.2, gateway_module/1.1.0, hdf4_handler/3.9.4, hdf5_handler/1.5.0, netcdf_handler/3.10.0, ncml_module/1.2.1, dap-server/usage/4.1.2, dap-server/www/4.1.2, xml_data_handler/1.0.1&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
::: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP-Server: TDS-4.19.3&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:; X-DAP&lt;br /&gt;
:: DAP4 servers MUST return the &#039;&#039;&#039;X-DAP&#039;&#039;&#039; HTTP header. This HTTP header is used in a response to indicate the DAP protocol version used to encode the content of the response. This value is constrained to a format of &#039;&#039;&amp;quot;major_version&amp;quot; dot &amp;quot;minor version&amp;quot;&#039;&#039;, where both major_version and minor_version are represented by an integer value.&lt;br /&gt;
:: &#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
::: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP: 4.0&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
:: &#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
::: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP: 2.17&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
===== Asynchronous Transaction =====&lt;br /&gt;
&lt;br /&gt;
:; X-DAP-Async-Required&lt;br /&gt;
:: DAP4 servers MUST return the &#039;&#039;&#039;X-DAP-Async-Required&#039;&#039;&#039; header if the request requires an asynchronous response and the client has not indicated willingness to accept such a response. Rejection of the request MUST also be indicated by an HTTP status code of 400, DAP Asynchronous Response Required.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async |DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Status Codes ===&lt;br /&gt;
&lt;br /&gt;
DAP servers that provide an HTTP interface are expected to utilize the HTTP response codes in a manner consistent with the HTTP 1.1 specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616|HTTP RFC2616]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The ones that are detailed here are used by the DAP in a manner consistent with the specifications definition, but in support of specific DAP server behavior.&lt;br /&gt;
&lt;br /&gt;
==== 200 OK ====&lt;br /&gt;
&lt;br /&gt;
A server MUST return an HTTP status of 200 when the request has been successful and that the returned document contains the requested resource. However since DAP responses can be quite large and since it is also possible for the server to encounter any number of problems during the marshaling, serialization, and subsequent transmission of the response it is possible that the server may have committed/transmitted the HTTP headers (in which the status value is transmitted) before a subsequent error is encountered. These types of errors are transmitted in the DAP4 over-the-wire protocol and all DAP4 clients MUST be able to read and process these errors.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot; size=&amp;quot;3&amp;quot;&amp;gt;See Section? I think that this should be a reference to volume 1, at least if we decide that the DAP4 Error Response semantics and content is defined there… [[User:Ndp|ndp]] 21:28, 7 November 2013 (PST)&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== 202 Accepted  ====&lt;br /&gt;
&lt;br /&gt;
A server MUST return a &#039;&#039;&#039;202 Accepted&#039;&#039;&#039; HTTP response code when a request has been accepted and will be handled asynchronously. The response body MUST contain a DAP4 asynchronous response accepted document.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.2.3|HTTP RFC2616 - Section 10.2.3]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async|Dap4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
==== 400 Bad Request ====&lt;br /&gt;
&lt;br /&gt;
The HTTP specification defines this status code as:&lt;br /&gt;
:&#039;&#039;The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.&#039;&#039;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.1|HTTP RFC2616 - Section 10.4.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; &lt;br /&gt;
DAP4 servers utilizes this code to mean the following.&lt;br /&gt;
&lt;br /&gt;
===== 400 Bad DAP4 Request Syntax =====&lt;br /&gt;
&lt;br /&gt;
:The &#039;&#039;&#039;400 Bad DAP4 Request Syntax&#039;&#039;&#039; HTTP response code MUST be returned by the server when there is a problem with the syntax of the OPeNDAP URL.  The problem could be in the formulation of the constraint expression, or it may be that the URL extension did not match any that are recognized by this server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
===== 400 DAP4 Asynchronous Response Required =====&lt;br /&gt;
&lt;br /&gt;
:The &#039;&#039;&#039;400 DAP4 Asynchronous Response Required&#039;&#039;&#039; HTTP response code MUST be returned by the server when the DAP request has been rejected because an asynchronous response is required and the client did not indicate willingness to accept an asynchronous response. The server MUST include the &#039;&#039;&#039;X-DAP-Async-Required&#039;&#039;&#039; HTTP header and the DAP4 Asynchronous Response Required document as the response body.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async|DAP4_Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
==== 401 Unauthorized ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;401 Unauthorized&#039;&#039;&#039; HTTP response code MUST be returned by the server when access to the requested resource requires (not previously acquired) user authentication. See the HTTP specification-1.1 for usage and behavior.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.2|HTTP RFC2616 - Section 10.4.2]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 403 Forbidden ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;403 Forbidden&#039;&#039;&#039; HTTP response code MUST be returned when the server has understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. This is appropriate to return if, for example, the server software does not have read permission for the requested resource.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.4|HTTP RFC2616 - Section 10.4.4]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 404 Not Found ====&lt;br /&gt;
The &#039;&#039;&#039;404 Not Found&#039;&#039;&#039; HTTP response code MUST be returned when the server has not found anything matching the Request-URI.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.5|HTTP RFC2616 - Section 10.4.5]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== 409 Conflict (DAP4 Async Response Not Available) ====&lt;br /&gt;
The &#039;&#039;&#039;409 Conflict&#039;&#039;&#039; HTTP response code SHOULD be returned by the server when the DAP request has been rejected because a previous asynchronous request has not been completed and the result is not ready for access. The response body MUST contain the &#039;&#039;&#039;DAP4 Asynchronous Response Not Yet Available&#039;&#039;&#039; document.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.10|HTTP RFC2616 - Section 10.4.10]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/sup&amp;gt;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async|DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 412 Precondition Failed ====&lt;br /&gt;
 &lt;br /&gt;
The &#039;&#039;&#039;412 Precondition Failed&#039;&#039;&#039; HTTP response code MUST be returned by the server if the DAP request has been rejected because it did not meet the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; condition that was specified in the request. The response body MUST contain the&#039;&#039;&#039;DAP4 Asynchronous Request Rejected&#039;&#039;&#039; document.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.13 |HTTP RFC2616 - Section 10.4.13]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Async|DAP4 Async]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
==== 415 Unsupported Media Type ====&lt;br /&gt;
 &lt;br /&gt;
The &#039;&#039;&#039;415 Unsupported Media Type&#039;&#039;&#039; HTTP response code MUST be returned when the client requests a representation of the requested resource that the server cannot provide.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.4.16 |HTTP RFC2616 - Section 10.4.16]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 500 Internal Server Error ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;500 Internal Server Error&#039;&#039;&#039; status code SHOULD be returned when the DAP server encounters internal problems when attempting to fulfill a request.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_10.5.1 |HTTP RFC2616 - Section 10.5.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Verbs (aka Methods) ===&lt;br /&gt;
&lt;br /&gt;
==== GET ====&lt;br /&gt;
&lt;br /&gt;
A DAP4 request may be made using the HTTP GET request method utilizing a Uniform Resource Identifier (URI) that encodes information specific to the DAP4.&lt;br /&gt;
&amp;lt;!--(&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;see Section ?&amp;lt;/font&amp;gt;). --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each GET request MUST conform to the HTTP specification (which basically says that a GET request MUST contain an HTTP protocol version number followed by a MIME-like message containing various headers that further describe the request.). While there are some optional  DAP4 HTTP request headers that may be used, DAP4 requests do not require specific HTTP headers beyond those necessary for HTTP (see section 4.5.1 Request Headers of this document for more). DAP4 servers SHOULD support the use of the HTTP Accept request header to allow clients to engage in HTTP content negotiation for specific representations of a requested DAP4 response.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#HTTP_RFC2616_Section_12 |HTTP RFC2616 - Section 12]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; Implementation Note&lt;br /&gt;
:&#039;&#039;In practice, DAP clients typically use a third-party library implementation of HTTP/1.1 so the GET request, URI and HTTP version information are hidden from the client; it sees only the DAP Uniform Resource Locator (URL) and the request headers.&#039;&#039;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DAP server responds to the GET request with an HTTP compliant response (one that includes a status line containing the HTTP protocol version and an error or success code, followed by HTTP response headers and then response itself). There are two DAP specific HTTP headers that are always included in a DAP response over HTTP: &amp;lt;font size=&amp;quot;3&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP-Server&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt; and &amp;lt;font size=&amp;quot;3&amp;quot;&amp;gt;&amp;lt;tt&amp;gt;X-DAP&amp;lt;/tt&amp;gt;&amp;lt;/font&amp;gt;,  as described in section 4.5.2 of this document.&lt;br /&gt;
The DAP response is the payload of the HTTP response.  Unless otherwise negotiated, the data response payload is encoded using the chunked format as described&lt;br /&gt;
in &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1 |DAP4 Vol.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;, while the other responses are simple HTTP responses.&lt;br /&gt;
&lt;br /&gt;
===== Examples =====&lt;br /&gt;
; HTTP GET request.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap?/u,/v[0:8:1024] HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
Accept: application/vnd.opendap.dap4.data&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
==== POST ====&lt;br /&gt;
&lt;br /&gt;
DAP4 supplies (via the DAP Service Terminus) a URI for each DAP4 service and each of its various media-type representations. How do we leverage this into a non-HTTP usage? I think we need to define a message document that is sent to the server (say over a socket) that carries everything we need in the request. Suggestion:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;request xmlns=&amp;quot;http://opendap.org/ns/dap4/request&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;service&amp;gt;dap4-data&amp;lt;/service&amp;gt;&lt;br /&gt;
  &amp;lt;media-type&amp;gt;...&amp;lt;/media-type&amp;gt;&lt;br /&gt;
  &amp;lt;dataset id=&amp;quot;/local/id/of/data/resource&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ce&amp;gt;&lt;br /&gt;
      &amp;lt;projection&amp;gt;x,y[0:3:99]&amp;lt;/projection&amp;gt;&lt;br /&gt;
      &amp;lt;selection&amp;gt;k&amp;lt;33 &amp;amp; i&amp;gt;17&amp;lt;/selection&amp;gt;&lt;br /&gt;
    &amp;lt;/ce&amp;gt;&lt;br /&gt;
  &amp;lt;/dataset&amp;gt;&lt;br /&gt;
&amp;lt;/request&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Obviously this needs more thought and discussion...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposal&#039;&#039;&#039;: The  DAP4 data model and it&#039;s persistent (over-the-wire) representations are transport protocol agnostic. All of the information required by the DAP must be present in the content of the DAP requests and responses.  The DAP won&#039;t uniquely embed information required by the DAP into HTTP Headers or AMQP thingys, or other whatnot. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion&#039;&#039;&#039;: &lt;br /&gt;
&lt;br /&gt;
# Does this matter?&lt;br /&gt;
# Would we need to add new syntax server-side functions etc. to the protocol to enable this?&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DAP4 URLs ==&lt;br /&gt;
&lt;br /&gt;
In DAP4 we divide a dataset URL into two sections, the &#039;&#039;identifier&#039;&#039; and the &#039;&#039;query string&#039;&#039;. The &#039;&#039;identifier&#039;&#039; section is everything up to &amp;quot;&#039;&#039;?&#039;&#039;&amp;quot; character. The &#039;&#039;query string&#039;&#039; is the &amp;quot;&#039;&#039;?&#039;&#039;&amp;quot; character and everything after it.&lt;br /&gt;
&lt;br /&gt;
For example in the URL:&lt;br /&gt;
:   &amp;lt;tt&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://test.opendap.org:8080/opendap/data/nc/fnoc1.nc.dmr?dap4.ce=/u;/lat;/lon&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have:&lt;br /&gt;
:   &#039;&#039;identifier = &#039;&#039; &amp;lt;tt&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://test.opendap.org:8080/opendap/data/nc/fnoc1.nc.dmr&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
:   &#039;&#039;query string = &#039;&#039; &amp;lt;tt&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;?dap4.ce=/u;/lat;/lon&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally DAP4 URLs conform to the web convention in which the query string is decomposed as a set of key-value pairs (KVP) separated from each other by &amp;quot;&#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;&amp;quot; characters:&lt;br /&gt;
: &amp;lt;code&amp;gt;?key=value&amp;amp;key=value&amp;amp;key=value ... &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Many web services utilize this pattern, including OGC. The DAP2 constraint expression subsumed the entire query string, so it did not fit into the standard KVP model. Tomcat (and other web server frameworks) provide specific API methods for collecting the KVP from the query string, but again DAP2 doesn&#039;t play well with this. The DAP4 constraint is designed to operate in a KVP environment.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
In DAP2 the constraint expression (CE) was defined as a &#039;&#039;projection&#039;&#039; and a &#039;&#039;selection&#039;&#039;. The &#039;&#039;projection&#039;&#039; being a list of dataset variables to be returned, and the &#039;&#039;selection&#039;&#039; being the conditions that must be met to return them. . The projected variables could, if they were arrays, be subset using a square bracket notation (rigorously described elsewhere). The &#039;&#039;selection&#039;&#039; was written as a list of &amp;quot;clauses&amp;quot; (my word),  separated from the &#039;&#039;projection&#039;&#039; and from each other by an &amp;quot;&amp;amp;&amp;quot; character. The &#039;&#039;selection&#039;&#039; was applied to all of the requested variables, and in practice was rarely used because the only legitimate application of the &#039;&#039;selection&#039;&#039;  was to constrain a Sequence object. Thus, the DAP2 CE consumed the entire URL query string, in other words everything after the &amp;quot;&#039;&#039;&#039;?&#039;&#039;&#039;&amp;quot; in the URL was considered to be the DAP2 CE string.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
=== Query String Parameters ===&lt;br /&gt;
&lt;br /&gt;
* DAP4 query string parameters will always begin with the 5 character string &amp;lt;tt&amp;gt;&amp;quot;&#039;&#039;&#039;dap4.&#039;&#039;&#039;&amp;quot;&amp;lt;/tt&amp;gt; In this way query string parameters associated with the DAP4 protocol can be easily identified by both people and software. &lt;br /&gt;
* DAP4 query string keys are case sensitive.&lt;br /&gt;
* DAP4 servers MUST treat ALL values of query string KVPs as case sensitive.&lt;br /&gt;
* Each DAP4 key may appear once in each query string (request URL).&lt;br /&gt;
* The order of the keys does not matter, and unrecognized keys are ignored, along with their values.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
While the initial DAP4 specification defines 3 &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;(Or is it 2?)&amp;lt;/font&amp;gt; query string keys,--&amp;gt;&lt;br /&gt;
The DAP4 protocol reserves the exclusive use of all future query string keys that begin with the 4 character token &amp;lt;tt&amp;gt;&amp;quot;&#039;&#039;&#039;dap4.&#039;&#039;&#039;&amp;quot;&amp;lt;/tt&amp;gt; This way future DAP4 service features may be added and invoked through the query string section of the request URL without interfering with other features and behaviors added to service implementations outside of the DAP4 development process.&lt;br /&gt;
&lt;br /&gt;
The following keys are reserved.&lt;br /&gt;
;&amp;lt;tt&amp;gt;dap4.ce&amp;lt;/tt&amp;gt;&lt;br /&gt;
: The DAP4 constraint expression is contained in a single query string parameter named &amp;lt;tt&amp;gt;&amp;quot;&#039;&#039;&#039;dap4.ce&#039;&#039;&#039;&amp;quot;&amp;lt;/tt&amp;gt; This constraint expression contains all of the subsetting information for the dataset include the projection (which variables are to be returned), slicing (how the various arrays are to be decimated), and filtering (conditional retrieval of values). The fill discussion of the syntax of the constraint expression can be found in Section 8 of Volume 1 of the DAP4 specification. &amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1 |DAP4 Vol.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;dap4.async&amp;lt;/tt&amp;gt;&lt;br /&gt;
: The asynchronous response behavior is described in detail in Section 10 of Volume 1 of the DAP4 Specification.&amp;lt;sup&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;[[#DAP4_Vol1 |DAP4 Vol.1]]&amp;lt;nowiki&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/sup&amp;gt; While the a DAP4 server&#039;s asynchronous response behavior can be controlled by a savvy client using HTTP headers it can also be managed using the DAP4 query string parameter &amp;lt;tt&amp;gt;&amp;quot;&#039;&#039;&#039;dap4.async&#039;&#039;&#039;&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;dap4.func&amp;lt;/tt&amp;gt;&lt;br /&gt;
: While server-side functions are not addressed in the initial DAP4 specification or constraint expression syntax we do anticipate them being defined (in short order) in an extension to the DAP4 specification. For now we are working with a proposed server side function syntax in which a server side function is invoked as a key value pair, something like: &amp;lt;tt&amp;gt;&#039;&#039;&#039;dap4.func=ugr5(0,v,z,”10&amp;lt;lat&amp;lt;30”)&#039;&#039;&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normative References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DAP4_Vol1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[DAP4 Vol1]&amp;lt;/nowiki&amp;gt; [[DAP4:_Specification_Volume_1|DAP4 Volume 1: Data Model, Persistent Representations, and Constraints]].&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;div id=&amp;quot;DAP4_DSR&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[DAP4 DSR]&amp;lt;/nowiki&amp;gt;  [[DAP4_Dataset_Services_Response|DAP4: Dataset Services Response]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;DAP4_Async&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[DAP4 Async]&amp;lt;/nowiki&amp;gt; [[DAP4:_Asynchronous_Request-Response_Proposal_v3|DAP4: Asynchronous Request/Response]].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616.html  Hypertext Transfer Protocol -- HTTP/1.1] (as [http://www.ietf.org/rfc/rfc2616.txt text]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.2.3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.2.3]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3 HTTP/1.1 Section 10.2.3 - Accepted]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.3]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3 HTTP/1.1 Section 10.3 - Redirection Status Codes]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.1]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1 HTTP/1.1 Section 10.4.1 - Bad Request]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.2]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 HTTP/1.1 Section 10.4.2 - Unauthorized]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.4]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4 HTTP/1.1 Section 10.4.4 - Forbidden]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.5&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.5]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 HTTP/1.1 Section 10.4.5 - Not Found]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.10]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10 HTTP/1.1 Section 10.4.10 - Conflict]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.13]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.13 HTTP/1.1 Section 10.4.13 - Precondition Failed]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.4.16&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.4.16]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16 HTTP/1.1 Section 10.4.16 - Unsupported Media Type]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_10.5.1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 10.5.1]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1 HTTP/1.1 Section 10.5.1 - Internal Server Error]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_12&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 12]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html HTTP/1.1 Section 12 - Content Negotiation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_13&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 13]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html HTTP/1.1 Section 13 - Caching]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_14.1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 14.1]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 HTTP/1.1 Section 14.1 - Accept Header]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_14.17&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 14.17]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 HTTP/1.1 Section 14.17 - Content-Type Header]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_14.30&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 14.30]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 HTTP/1.1 Section 14.30 - Redirection Response Headers]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_14.43&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 14.43]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 HTTP/1.1 Section 14.43 - User-Agent Header]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2616_Section_15&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2616 - Section 15]&amp;lt;/nowiki&amp;gt; [http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html HTTP/1.1 Section 15 - Security Considerations]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;HTTP_RFC2617&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[HTTP RFC2617]&amp;lt;/nowiki&amp;gt; [http://www.ietf.org/rfc/rfc2617.txt - HTTP Authentication]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;RFC1123&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[RFC1123]&amp;lt;/nowiki&amp;gt; [http://www.ietf.org/rfc/rfc1123.txt - Requirements for Internet Hosts]&lt;br /&gt;
&lt;br /&gt;
== Non-Normative References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;REST_Fielding&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[REST] R. Fielding, UC Irvine Doctoral Thesis: [http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm|&amp;quot;Architectural Styles and the Design of Network-based Software Architectures&amp;quot;]&lt;br /&gt;
&amp;lt;div id=&amp;quot;MediaType&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[MediaType] Wikipedia: [http://en.wikipedia.org/wiki/Internet_media_type Internet Media Type]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Appendix - Ancillary Web Services (Beyond DAP4) ==&lt;br /&gt;
&lt;br /&gt;
DAP4 servers MAY offer a number of other services that, while not exactly DAP4 services per say, are commonly available. This section lists some of the alternate services a DAP4 server might provide. By enumerating the available services in the Dataset Services Response servers can easily make software clients and the people that use them aware of the server&#039;s ancillary capabilities.&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: HTML DATA Request Form Service]] ====&lt;br /&gt;
The HTML DATA Request Form Service provides browser based access to the Dataset. When invoked it returns a web-browser renderable document (in html) that provides a form (or other UI) that can be used to constrain and request data in accordance with the DAP4 specification as applied to the dataset .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/data-request-form#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt; | &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xhtml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: RDF Service  | DAP4: RDF Service]] ====&lt;br /&gt;
The RDF service provides an RDF representation of the Dataset document (DDX). The RDF response is an XML document containing an RDF version of the [[DAP4: Responses#Dataset_Response | DAP4: Dataset Response.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.rdf&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .rdf&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/rdf#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/rdf+xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: ISO 19115 Service ]] ====&lt;br /&gt;
This service provides ISO 19115 metadata for the Dataset, if any can be found. When invoked  it returns an XML document containing ISO 19115 metadata located in the  [[DAP4: Responses#Dataset_Response | DAP4: Dataset Response.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.iso&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .iso&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/iso-19115-metadata#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: ISO Conformance Score Service ]] ====&lt;br /&gt;
This service provides a browser renderable document that describes how well the metadata held in the Dataset conforms to ISO 19115. When invoked this service returns a browser renderable document that scores how well the metadata held in the [[DAP4: Responses#Dataset_Response | Dataset Response]] conforms to ISO 19115.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.rubric&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .rubric&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/iso-19115-score#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: NetCDF File-out Service ]] ====&lt;br /&gt;
This service provides data responses in NetCDF-4 file format. When invoked the regular DAP data response will be repackaged as a NetCDF 4 file. &lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.nc4&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.nc4&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/netcdf-3#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/x-netcdf-4&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: ASCII Data Service]] ====&lt;br /&gt;
This service provides data responses in ASCII format. When invoked the regular DAP data response will be repackaged as an ASCII representation of the data values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.ascii&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.ascii&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/ascii#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/plain&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: XML Data Service]] ====&lt;br /&gt;
This service provides data responses in XML format. When invoked the constrained Dataset response document (DDX) will be marked up with the data values of the request and returned. Large requests may be denied.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.xdap&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.xdap&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/xml-data#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: Native File Access Service ]] ====&lt;br /&gt;
This service provides direct access to the data source file (or whatever else) that is creating the DAP dataset resource. When invoked it returns the &amp;quot;native&amp;quot; data from whatever store (filesystem, etc.) it may be in. Servers MAY elect to not support this response, for example, for generated data, very large data, et cetera.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.file&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .file&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/file#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: Type varies with file type.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP4: Server Version Service  ]]====&lt;br /&gt;
This service provides software versioning information. When invoked the service returns an XML file containing a description of the version of the server and it&#039;s components.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.ver&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .ver&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/version#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DAP2 Services ===&lt;br /&gt;
&lt;br /&gt;
In order to support legacy client applications DAP4 server implementations MAY support the DAP2 services stack. If they do so the DAP2 services MUST be organized as described in this section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: Data Service]]====&lt;br /&gt;
The DAP2 data service provides DAP2 data access to the data resource.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dods&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.dods&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap2/dods#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/octet-stream&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: DDX Service ]]====&lt;br /&gt;
The DAP2 DDX service provides DAP2 access to the data resource metadata. When invoked the service returns an XML document containing both syntactic and semantic  dataset metadata in DAP2 XML format.&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.ddx&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .ddx&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap2/ddx#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: DDS Service ]]====&lt;br /&gt;
The DAP2 DDS service provides access to the &#039;syntactic&#039; metadata (aka use or structural metadata) for the data resource. When invoked returns a DAP2 DDS response document conforming to the DDS part of the DAP2 specification.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.dds&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.dds&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap2/dds#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/plain&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: DAS Service ]] ====&lt;br /&gt;
The DAP2 DAS service provides access to the &#039;semantic&#039; metadata (aka domain metadata) for the data resource. When invoked returns a DAP2 DAS response document conforming to the DAS part of the DAP2 specification.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.das&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .das&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap2/das#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/plain&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: Info Service ]] ====&lt;br /&gt;
The DAP2 INFO service provides a browser renderable page that combines both the DAP2 &#039;syntactic&#039; and &#039;semantic&#039; metadata for the data resource in a human readable way. When invoked this service returns a web browser renderable document that combines both the DAP2 &#039;syntactic&#039; and  &#039;semantic&#039; metadata for the data resource in a human readable way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.info&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + .info&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap2/Info#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;text/html&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[DAP2: NetCDF Service ]] ====&lt;br /&gt;
This service provides data responses in NetCDF-3 file format. When invoked the regular DAP data response will be repackaged as a NetCDF 3 file. &lt;br /&gt;
&lt;br /&gt;
suffix = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;.nc&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
service url =  &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;dataset_url + &#039;.nc&#039; + [?dap_constraint]&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
role id = &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/netcdf-3#&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default/primary media type: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/x-netcdf&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Template: ServiceTemplate]]&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10558</id>
		<title>DAP4: Specification Volume 3</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10558"/>
		<updated>2014-07-04T02:58:32Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 3: DAP4 Extensions&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;July 4, 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;04 July 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2014 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;It is anticipated that over time, extensions to the DAP4 protocol will be defined and implemented by servers. Volume 3 of the DAP4 specification describes extensions which are expected to be commonly implemented.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Created volume 3 containing the extensions&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Extension: Asynchronous Response==&lt;br /&gt;
This document specifies the DAP4 Asynchronous HTTP Response extension. It defines the set of HTTP mechanisms used by DAP4 clients and servers when requesting or delivering asynchronous responses.&lt;br /&gt;
&lt;br /&gt;
This extension provides DAP4 with a mechanism that allows servers to handle requests where the construction or computation of the response takes more time than a client may wish to wait.&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Extension Details ===&lt;br /&gt;
&lt;br /&gt;
The Role URI for the DAP4 Asynchronous HTTP Response extension is&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/extension/asynchronous-http-response&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DAP4 servers MUST include this role URI in a Dataset Service Response [DSR] &#039;&#039;extension&#039;&#039; element to indicate that the DAP4 Asynchronous HTTP Response extension is supported for the dataset (?represented by that DSR?). DAP4 clients MAY check for DSR &#039;&#039;&#039;extension&#039;&#039;&#039; elements with this role URI to determine if the DAP4 Asynchronous HTTP Response extension is supported.&lt;br /&gt;
&lt;br /&gt;
Dataset Service Response [DSR] &#039;&#039;extension&#039;&#039; elements must also contain a name and a description. The following are recommended text for the name and description:&lt;br /&gt;
&lt;br /&gt;
;Name&lt;br /&gt;
: DAP4 Asynchronous HTTP Response&lt;br /&gt;
&lt;br /&gt;
;Description &lt;br /&gt;
: This extension provides DAP4 with a mechanism to support asynchronous HTTP responses, e.g., when a request will take the server time to fulfill.&lt;br /&gt;
&lt;br /&gt;
== Summary of HTTP Mechanisms Used to Support Asynchronous HTTP Response ==&lt;br /&gt;
&lt;br /&gt;
Role: http://services.opendap.org/dap4/async&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
* DAP4 Asynch Response document:&lt;br /&gt;
** Media Type: application/vnd.opendap.dap4.async+xml&lt;br /&gt;
** XML Namespace: http://opendap.org/ns/dap/asynchronous&lt;br /&gt;
** Types of documents&lt;br /&gt;
*** Required&lt;br /&gt;
*** Accepted&lt;br /&gt;
*** Not Yet Available&lt;br /&gt;
*** Gone&lt;br /&gt;
&lt;br /&gt;
HTTP Request Headers&lt;br /&gt;
&lt;br /&gt;
HTTP Response Headers&lt;br /&gt;
&lt;br /&gt;
URL Query String: dap4.async&lt;br /&gt;
&lt;br /&gt;
== Overview: Asynchronous Service Behavior and Responses ==&lt;br /&gt;
Asynchronous responses are responses that will take the server some time to build. When a client is told that a response &#039;is asynchronous,&#039; it must know to come back at a later time to retrieve the response. The concept is a very simple one, and the existing network infrastructure is very good at supporting these kinds of interactions. A major factor in the success of the proposed solution will be the level of uniform support for the design. Secondly, as is often the case, the details will be more complex than the underlying concept. In particular, the request mechanism must be extended so that synchronous (regular) requests are not affected by the addition of asynchronous requests and, at the same time, clients do not inadvertently make asynchronous requests. another detail is that the (asynchronous) responses are &#039;&#039;ephemeral&#039;&#039; because they typically only persist for a period of time and then be purged.&lt;br /&gt;
&lt;br /&gt;
A typical &#039;workflow&#039; for an asynchronous request is:&lt;br /&gt;
# A client makes a data request that indicates that it will accept either an asynchronous or synchronous response. Optionally, the client can place a time constraint on the response, indicating that if the response will not be ready in a given period of time, it does not want the response.&lt;br /&gt;
# The server returns an initial response (without delay) that indicates the request has indeed resulted in an asynchronous response and provides the client with a URL and time estimate. &lt;br /&gt;
# The client reads the time estimate and waits...&lt;br /&gt;
# The client dereferences the URL and gets the response.&lt;br /&gt;
&lt;br /&gt;
; Examples&lt;br /&gt;
: A  DAP4 server that is retrieving data content from a near-line tape storage subsystem might take several minutes to access a particular data holding. &lt;br /&gt;
: A DAP4 server that is providing access to data held in an Amazon Web Services Glacier Vault will have to wait ~4 hours before it can retrieve a particular holding. &lt;br /&gt;
In these circumstances the server may return the DAP4 Asynchronous Response.&lt;br /&gt;
&lt;br /&gt;
The remainder of this section will expand on this basic workflow using examples that focus on the HTTP protocol but that also allow for the use of other transport protocols.&lt;br /&gt;
&lt;br /&gt;
== Client willingness to accept asynchronous responses ==&lt;br /&gt;
A client can indicate willingness to accept asynchronous responses in one of two ways:&lt;br /&gt;
* By including the [[#Accept DAP Asynchronous Response|X-DAP-Async-Accept]] HTTP header.&lt;br /&gt;
* By adding the [[#DAP4_Constraint_Expression_extension_for_Async | dap4.async]] keyword to the DAP constraint expression.&lt;br /&gt;
&lt;br /&gt;
If the client indicates that it must have access to the asynchronous response content within a certain time (utilizing either the  [[#Accept DAP Asynchronous Response|X-DAP-Async-Accept]] HTTP header and/or the [[#DAP4_Constraint_Expression_extension_for_Async | async]] keyword in the constraint expression) and the response will not be available in that time frame, the server MUST reject the request and return an HTTP status of [[#412_Precondition_Failed | 412]] and the [[#DAP Asynchronous Request Rejected | DAP Asynchronous Request Rejected]] XML document.&lt;br /&gt;
&lt;br /&gt;
If both the &#039;&#039;X-DAP-Async-Accept&#039;&#039; HTTP header and the &#039;&#039;dap4.async&#039;&#039; keyword are used, the keyword takes precedence.&lt;br /&gt;
&lt;br /&gt;
Servers must reject requests that require an asynchronous response if the client has not indicated willingness to accept such a response. Rejection of such requests is indicated by all three of the following:&lt;br /&gt;
# [[#400 DAP Asynchronous Response Required| HTTP status of 400]]&lt;br /&gt;
# Inclusion of the [[#DAP Asynchronous Response Required|X-DAP-Async-Required]] HTTP response header&lt;br /&gt;
# The response body must contain the [[#DAP_Asynchronous_Response_Required | DAP Asynchronous Response Required]] XML document. &lt;br /&gt;
This safety check (requiring clients to explicitly indicate their willingness to accept asynchronous responses) is required because otherwise very simple clients might inadvertently make requests that will result in an asynchronous responses, and these kinds of responses are likely to use disproportionately (relative to synchronous responses) more server resources. We want to make DAP4 so that simple clients work well and don&#039;t encounter unexpected &#039;hiccups.&#039;&lt;br /&gt;
&lt;br /&gt;
== Initial processing by the server ==&lt;br /&gt;
When a request is accepted by the server and it will result in an asynchronous response, the server MUST return a 202 (Accepted) HTTP status code and the [[#DAP Asynchronous Request Accepted | DAP Asynchronous Request Accepted ]] XML document. This document contains a URL to the pending result of the request.&lt;br /&gt;
&lt;br /&gt;
Of course, this discussion is about the mechanism that enables a client to make a request and the server to provide &#039;&#039;information about&#039;&#039; an asynchronous response to that request. It does not cover any of the nearly infinite ways a server might actually make the &#039;&#039;content&#039;&#039; of that response. It is likely that servers will write the responses to files and the URL returned to the client will be used to retrieve that file, but there&#039;s no requirement that servers do that. The only requirements on server are that:&lt;br /&gt;
#The URL returned asserts, using the [[#DAP4_Constraint_Expression_extension_for_Async | constraint expression syntax for async]] that the client accepts async responses.&lt;br /&gt;
# The URL returned can be dereferenced and that operation will return the response requested by the client.&lt;br /&gt;
&lt;br /&gt;
== Response retrieval by the client ==&lt;br /&gt;
When a client requests an asynchronous result that is ready, the server MUST return a 200 (OK) HTTP status code and the resulting data response. If the client attempts to access the asynchronous result prior to it&#039;s availability, the server SHOULD return an HTTP response status of  [[#409_Conflict_-_DAP4_Response_Not_Ready | 409 (DAP Response Not Ready)]] along with the [[#DAP4_Asynchronous_Response_Not_.28Yet.29_Available | DAP Asynchronous Response Not Available]] XML document. If the server does not return the 409 response status then it MUST return a 404 (Not Found) response along with whatever document it deems fit as the response body.&lt;br /&gt;
&lt;br /&gt;
If the client attempts to access the asynchronous result after it is no longer available, the server SHOULD return an [[#410_Gone_-_DAP4_Response_No_Longer_Available | HTTP response status of 410 (Gone)]] along with the [[#DAP4_Asynchronous_Response_Gone| DAP4 Asynchronous Response Gone]] document. If the server does not return the 410 response status then the server MUST return a 404 (Not Found) response along with whatever document it deems fit as the response body.&lt;br /&gt;
&lt;br /&gt;
In each case above where the server SHOULD return a specific error code, but may return a 404 code instead, the intent is for servers to provide the most appropriate use of HTTP/1.1&#039;s error codes while also providing servers with an &#039;out&#039; when that is hard for them to do. For example, knowing that a response, which is essentially ephemeral, is gone would, in theory, require to server to keep a record of every URL ever issued for an asynchronous response and that is not practical. At the same time, it is easy to see that a client would really like to know that the response has not yet been finished (i.e., it has not waited long enough) or that it is gone (i.e., it waited too long).&lt;br /&gt;
&lt;br /&gt;
== Detail: Client requests ==&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Constraint Expression extension for Async ===&lt;br /&gt;
By adding a keyword/value pair to the DAP4 query string we can allow a client to encode it&#039;s willingness to accept an asynchronous response, along with the a maximum amount of time the client can wait before it can access the response. &lt;br /&gt;
&lt;br /&gt;
; dap4.async&lt;br /&gt;
: A value of zero indicates the client is willing to unconditionally accept an asynchronous response. A positive integer value will be interpreted as the number of seconds that the client will wait for access to the response. If the value is negative the serve MUST return an error. &lt;br /&gt;
&lt;br /&gt;
; Examples&lt;br /&gt;
: Client is willing to unconditionally accept an asynchronous response&lt;br /&gt;
:: &amp;lt;code&amp;gt;?dap4.async=0&amp;lt;/code&amp;gt;&lt;br /&gt;
: Client is willing to wait for 60 seconds for access to the asynchronous response&lt;br /&gt;
:: &amp;lt;code&amp;gt;?dap4.async=60&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== X-DAP-Async-Accept ===&lt;br /&gt;
&lt;br /&gt;
A client may indicate willingness to accept asynchronous responses by including the &#039;&#039;X-DAP-Async-Accept&#039;&#039; HTTP header. Clients can make conditional requests for asynchronous responses by indicating the maximum time they are willing to wait by using the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; HTTP header with a value given in seconds. A value of zero indicates that the client is willing to accept whatever delay the server may encounter.&lt;br /&gt;
&lt;br /&gt;
== Detail: Server responses ==&lt;br /&gt;
&lt;br /&gt;
Several &#039;experimental&#039; HTTP headers are used by this design. They convey information either in the request (like the &#039;&#039;X-DAP-Async-Accept&#039;&#039; described above) or they encode information for a response. While only clients that intend to support asynchronous responses need to understand all of these, &#039;&#039;every&#039;&#039; client SHOULD understand the &#039;&#039;X-DAP-Async-Required&#039;&#039; header. Because we need to support clients like web browsers, knowledge of that header is not required, but DAP4-specific clients will provide the most information to users if they know to look for at least that response header.&lt;br /&gt;
&lt;br /&gt;
=== HTTP Response Headers ===&lt;br /&gt;
==== X-DAP-Async-Required ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;X-DAP-Async-Required&#039;&#039; HTTP response header is included in the response if the request requires an asynchronous response and the client has not indicated willingness to accept such a response. Rejection of the request should also be indicated by the [[#400_DAP4_Asynchronous_Response_Required |400 DAP Asynchronous Response Required]] HTTP response code.&lt;br /&gt;
&lt;br /&gt;
==== X-DAP-Async-Accepted ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;X-DAP-Async-Accepted&#039;&#039; HTTP response header is included in the response if the server has accepted an asynchronous request. Acceptance of the request should also be indicated by the [[#202_Accepted|202 Asynchronous Request Accepted]] HTTP response code.&lt;br /&gt;
&lt;br /&gt;
=== HTTP Response Codes ===&lt;br /&gt;
&lt;br /&gt;
HTTP provides a number of response codes beyond the simple 200 (OK), 404 (Not Found) and 500 (Internal Server Error). In this design we describe how those standard codes SHOULD be used by DAP4 servers. We don&#039;t enumerate all of the possible codes, instead opting for a description of those that most relevant.&lt;br /&gt;
&lt;br /&gt;
==== 202 Accepted ====&lt;br /&gt;
&lt;br /&gt;
A server indicates that a request has been accepted and will be handled asynchronously by returning a &#039;202 Accepted&#039; HTTP response code. The response body must contain a document in one of the asynchronous information media types listed [[#Media Types|below]]. A server MUST return this response, and only do so, when a client has indicated a willingness to process an asynchronous response and the response will actually be returned using the asynchronous mechanism.&lt;br /&gt;
&lt;br /&gt;
==== 400 DAP4 Asynchronous Response Required ====&lt;br /&gt;
&lt;br /&gt;
The &#039;400 DAP Asynchronous Response Required&#039; HTTP response code is used to indicate that the DAP4 request has been rejected because an asynchronous response is required and the client did not indicate willingness to accept an asynchronous response.&lt;br /&gt;
&lt;br /&gt;
The response code text is used to indicate the reason for the rejection. However, since the &#039;400&#039; HTTP response code is not specific to asynchronous DAP (the standard text for the &#039;400&#039; code is &amp;quot;Bad Request&amp;quot;), the &#039;&#039;X-DAP-Async-Required&#039;&#039; HTTP response header is also included in the response (see [[#Accept DAP Asynchronous Response|above]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that a standard 400 HTTP response code is returned. In this way, a client that does not understand asynchronous DAP can fail gracefully. The response code text message has been changed to be more informative of the reason for the failure. For clients that are aware of asynchronous DAP, the &amp;quot;DAP-Async-Required&amp;quot; header is set to &amp;quot;true&amp;quot;. The body of the response also returns some information the client can use to decide on how it will continue.&lt;br /&gt;
&lt;br /&gt;
==== 409 Conflict - DAP4 Response Not Ready ====&lt;br /&gt;
&lt;br /&gt;
The &#039;409 Conflict&#039; HTTP response code MAY be returned by a server to indicate that the DA4P request has been rejected because a previous asynchronous request has not been completed and the result is not ready for access. If a server utilizes the &#039;409 Conflict&#039; HTTP response code it must also return a [[#DAP4_Asynchronous_Response_Not_.28Yet.29_Available | DAP4 Asynchronous Response Not Yet Available]] document in the response body.&lt;br /&gt;
&lt;br /&gt;
==== 410 Gone - DAP4 Response No Longer Available ====&lt;br /&gt;
&lt;br /&gt;
The &#039;410 Gone&#039; HTTP response code MAY be used by a server to indicate that the result of an asynchronous request is no longer available. If a server utilizes the &#039;410 Gone&#039; HTTP response code it must also return a [[#DAP4_Asynchronous_Response_Gone | DAP4 Asynchronous Response Gone]] document in the response body.&lt;br /&gt;
&lt;br /&gt;
==== 412 Precondition Failed====&lt;br /&gt;
&lt;br /&gt;
The &#039;412 Precondition Failed&#039; HTTP response code is used to indicate that the DAP request has been rejected because it did not meet the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; condition (see [[#Accept DAP Asynchronous Response Conditionally on Estimated Time to Completion|above]]) that was specified in the request.&lt;br /&gt;
&lt;br /&gt;
==== 500 Internal Error====&lt;br /&gt;
&lt;br /&gt;
The &#039;500 Internal Error&#039; HTTP response code is used to indicate that the DAP request has caused an error on the server. The request body and other headers must be compliant with the [[DAP4_Web_Services_v3#DAP4_Error_Response | DAP4 Error Response]] and [[DAP4_Web_Services_v3#Status_Codes | Status Codes]] sections of the [[DAP4_Web_Services_v3 | web services specification]]. The request should not be repeated.&lt;br /&gt;
&lt;br /&gt;
=== Asynchronous Response Documents ===&lt;br /&gt;
&lt;br /&gt;
The uses of these documents are:&lt;br /&gt;
* to inform clients that a request will result in an asynchronous response;&lt;br /&gt;
* to provide clients with the status of an an accepted asynchronous request; and&lt;br /&gt;
* to inform clients that a request for and asynchronous response has been rejected.&lt;br /&gt;
&lt;br /&gt;
These response documents are the payloads to various responses, including errors. By using the HTTP 400-series error response codes, the design ensures that generic web clients will understand that their request was in error (even if they don&#039;t really understand why). The text provided with the response code will be sufficient that person could understand the gist of the problem, if not more. The response documents described here, along with the &#039;&#039;X-DAP&#039;&#039; describe above, are a way of providing additional information to a savvy client so that it can take full advantage of the synchronous response system.&lt;br /&gt;
&lt;br /&gt;
These documents are XML that follows the DAP Asynchronous XML schema and are declared in the namespace &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://opendap.org/ns/dap/asynchronous&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Required ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a request will result in an asynchronous response, and that the client has not yet indicated it&#039;s willingness to accept  an asynchronous response. It might seem superfluous to include a document that clearly only a client knowledgable about the asynchronous response features could parse, but many such clients may not, as a matter of course, indicate they will accept these responses. For example, a user-configurable parameter might be turn off support for the feature. The &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements convey information about conditions the clients can expect if it submits an asynchronous request for the response. As noted below, these are estimates made by the server since a number of things that the server cannot predict can affect them in the interleaving time between the client&#039;s requests. Additionally, a server MAY return values of zero for either of the values, indicating that it cannot make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;required&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This response MUST be associated with the 400 HTTP response code and the &#039;&#039;X-DAP-Async-Required&#039;&#039; response header.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Request Accepted ====&lt;br /&gt;
&lt;br /&gt;
This response informs clients that a request resulting in an asynchronous response has been accepted, along with operational information about retrieving the asynchronous response result. Note that the &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements are an estimate by the server. A server SHOULD ensure that the response will remain available for the time period given by &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039;. We say &#039;&#039;SHOULD&#039;&#039; and not &#039;&#039;MUST&#039;&#039; because we cannot predict all possible operational situations where these kinds of responses might be used. For example, a server might be providing access for several types of users who might have different access priorities, especially to limited resources like those typically involved with asynchronous access, and thus some responses might be further delayed, or removed early, to enable processing of requests from users with higher priority. It should be kept in mind, however, that the usefulness of the asynchronous responses will depend, in part, on servers providing a facility on which clients can depend.&lt;br /&gt;
&lt;br /&gt;
While the &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements are required, a server MAY set their &#039;&#039;seconds&#039;&#039; attribute to &#039;&#039;0&#039;&#039; to indicate that it cannot provide a reliable value. In this case, clients SHOULD poll every 300 seconds and servers SHOULD expect this behavior. This is the default TCP user timeout period (see http://tools.ietf.org/html/rfc5482).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;accepted&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;link href=&amp;quot;http://server.org/async/path/result&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This response document MUST be associated with the 202 HTTP status code and the &#039;&#039;X-DAP-Async-Accepted&#039;&#039; response header.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Not (Yet) Available ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a while a previous request for an asynchronous response has been accepted, the result is not available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;pending&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST be associated with the [[#409_Conflict_-_DAP4_Response_Not_Ready | 409 HTTP response code]]. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document and it&#039;s associated HTTP status of 409,  but servers MAY return any document in the response body along with either a a 404 (Not Found) or a 400 (Bad Request) HTTP status.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Gone ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a while a previous request for an asynchronous response has been accepted, the result is &#039;&#039;no longer&#039;&#039; available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;gone&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST be associated with the [[#410_Gone_-_DAP4_Response_No_Longer_Available| 410 HTTP status code]]. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document and it&#039;s associated HTTP status of 410,  but servers MAY return any document in the response body along with either a a 404 (Not Found) or a 400 (Bad Request) HTTP status.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Request Rejected ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a request for an asynchronous response has been rejected, even though the client said it is willing to process an asynchronous response. There are at least as many reasons a server might reject the request for an asynchronous response as there are systems that might return such responses. However, this design provides suggested response codes for cases that seem likely so that clients can make educated decisions about the reason for the rejection. The reason codes supported are:&lt;br /&gt;
;time: The client indicated that it was only willing to wait &#039;&#039;X&#039;&#039; seconds and the server thought it would take more time to build the result.&lt;br /&gt;
;unavailable: A needed resource is not available. This might indicate that hardware, like a robot tape system, cannot be currently accessed.&lt;br /&gt;
;privileges: The client is not allowed to make the request. &lt;br /&gt;
;other: Self evident...&lt;br /&gt;
In addition to the reason codes, this response will contain a text description of the reason for rejection.&lt;br /&gt;
&lt;br /&gt;
Servers SHOULD make every effort to use the correct reason codes and provide cogent descriptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;rejected&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;reason code=&amp;quot;time&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;description&amp;gt;Acceptable access delay was less than estimated delay.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST associated with the 412 HTTP status code. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document along with an HTTP status of 412, but servers MAY return any document in the response body along with an HTTP status of 404 (Not Found) or of 400 (Bad Request) in its place.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Error ====&lt;br /&gt;
&lt;br /&gt;
If the server encounters an error it must MUST (MAY?) return an HTTP status of 500 (Internal Error) along with a  request body and other headers compliant with the [[DAP4_Web_Services_v3#DAP4_Error_Response | DAP4 Error Response]] and [[DAP4_Web_Services_v3#Status_Codes | Status Codes]] sections of the [[DAP4_Web_Services_v3 | web services specification]]. The request should not be repeated.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response using GET ===&lt;br /&gt;
&lt;br /&gt;
; Simple Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server decides it needs to handle this request in an asynchronous manner, it will refuse the request because it did not say it would accept an asynchronous response.&lt;br /&gt;
&lt;br /&gt;
; Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
400 DAP Asynchronous Response Required&lt;br /&gt;
X-DAP-Async-Required: true&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;required&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response with DAP-Async-Accept Request Header ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
X-DAP-Async-Accept: 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap?dap4.async=0&amp;amp;dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
202 Accepted&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;accepted&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;link href=&amp;quot;http://server.org/async/path/result&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NB&#039;&#039;&#039;: This example originally included an &#039;&#039;Accept&#039;&#039; header with the value of &#039;&#039;multipart/mixed&#039;&#039;. However, that is not a good example. The HTTP/1.1 specification says that when a specific media type is indicated as the only one acceptable, a server must return a 406 response code if it cannot return that media type. The meaning of &#039;&#039;Accept: */*&#039;&#039; is the same as not including the header, so I have removed the header from these examples. We need to be heads up in the ways that we suggest that header should be used by clients&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response with conditional DAP-Async-Accept Request Headers ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
X-DAP-Async-Accept: 60&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap?dap4.async=60&amp;amp;dap4.ce=/x;/y;temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
412 Precondition Failed&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;rejected&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;reason code=&amp;quot;time&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;description&amp;gt;Acceptable access delay was less than estimated delay.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Premature Request For Asynchronous Result ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /async/path/data.nc?dap4.ce=/x;/y/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /async/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
409 Conflict&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;pending&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resource Role ==&lt;br /&gt;
&lt;br /&gt;
DAP4 Asynchronous Responses are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/async&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Normative Encoding of the Asynchronous Response ==&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Asynchronous Response is defined in Appendix x &amp;quot;Normative XML Encoding of the Asynchronous Response&amp;quot;. The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.async.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10557</id>
		<title>DAP4: Specification Volume 3</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10557"/>
		<updated>2014-07-04T02:52:48Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;The Data Access Protocol: DAP Version 4.0&#039;&#039;&#039;&amp;lt;/div&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 24pt;line-height: 100%&amp;quot;&amp;gt;&#039;&#039;&#039;Volume 3: DAP4 Extensions&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Date:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;July 4, 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Last Revised:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;04 July 2014&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Status:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Authors:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;John Caron (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Ethan Davis (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;David Fulker (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;James Gallagher (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Dennis Heimbigner (Unidata)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Nathan Potter (OPeNDAP)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;20%&amp;quot;&amp;gt;Copyright:&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;2014 University Corporation for Atmospheric Research and Opendap.org&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Abstract&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;i&amp;gt;It is anticipated that over time, extensions to the DAP4 protocol will be defined and implemented by servers. Volume 3 of the DAP4 specification describes extensions which are expected to be commonly implemented.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Distribution of this document is unlimited.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Change List&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=1 width=&amp;quot;85%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Initial Draft&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;25%&amp;quot;&amp;gt;2014.07.04&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;td&amp;gt;Created volume 3 containing the extensions&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Extension: Asynchronous Response==&lt;br /&gt;
This document specifies the DAP4 Asynchronous HTTP Response extension. It defines the set of HTTP mechanisms used by DAP4 clients and servers when requesting or delivering asynchronous responses.&lt;br /&gt;
&lt;br /&gt;
This extension provides DAP4 with a mechanism that allows servers to handle requests where the construction or computation of the response takes more time than a client may wish to wait.&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Extension Details ===&lt;br /&gt;
&lt;br /&gt;
The Role URI for the DAP4 Asynchronous HTTP Response extension is&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/extension/asynchronous-http-response&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DAP4 servers MUST include this role URI in a Dataset Service Response [DSR] &#039;&#039;extension&#039;&#039; element to indicate that the DAP4 Asynchronous HTTP Response extension is supported for the dataset (?represented by that DSR?). DAP4 clients MAY check for DSR &#039;&#039;&#039;extension&#039;&#039;&#039; elements with this role URI to determine if the DAP4 Asynchronous HTTP Response extension is supported.&lt;br /&gt;
&lt;br /&gt;
Dataset Service Response [DSR] &#039;&#039;extension&#039;&#039; elements must also contain a name and a description. The following are recommended text for the name and description:&lt;br /&gt;
&lt;br /&gt;
;Name&lt;br /&gt;
: DAP4 Asynchronous HTTP Response&lt;br /&gt;
&lt;br /&gt;
;Description &lt;br /&gt;
: This extension provides DAP4 with a mechanism to support asynchronous HTTP responses, e.g., when a request will take the server time to fulfill.&lt;br /&gt;
&lt;br /&gt;
== Summary of HTTP Mechanisms Used to Support Asynchronous HTTP Response ==&lt;br /&gt;
&lt;br /&gt;
Role: http://services.opendap.org/dap4/async&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&lt;br /&gt;
* DAP4 Asynch Response document:&lt;br /&gt;
** Media Type: application/vnd.opendap.dap4.async+xml&lt;br /&gt;
** XML Namespace: http://opendap.org/ns/dap/asynchronous&lt;br /&gt;
** Types of documents&lt;br /&gt;
*** Required&lt;br /&gt;
*** Accepted&lt;br /&gt;
*** Not Yet Available&lt;br /&gt;
*** Gone&lt;br /&gt;
&lt;br /&gt;
HTTP Request Headers&lt;br /&gt;
&lt;br /&gt;
HTTP Response Headers&lt;br /&gt;
&lt;br /&gt;
URL Query String: dap4.async&lt;br /&gt;
&lt;br /&gt;
== Overview: Asynchronous Service Behavior and Responses ==&lt;br /&gt;
Asynchronous responses are responses that will take the server some time to build. When a client is told that a response &#039;is asynchronous,&#039; it must know to come back at a later time to retrieve the response. The concept is a very simple one, and the existing network infrastructure is very good at supporting these kinds of interactions. A major factor in the success of the proposed solution will be the level of uniform support for the design. Secondly, as is often the case, the details will be more complex than the underlying concept. In particular, the request mechanism must be extended so that synchronous (regular) requests are not affected by the addition of asynchronous requests and, at the same time, clients do not inadvertently make asynchronous requests. another detail is that the (asynchronous) responses are &#039;&#039;ephemeral&#039;&#039; because they typically only persist for a period of time and then be purged.&lt;br /&gt;
&lt;br /&gt;
A typical &#039;workflow&#039; for an asynchronous request is:&lt;br /&gt;
# A client makes a data request that indicates that it will accept either an asynchronous or synchronous response. Optionally, the client can place a time constraint on the response, indicating that if the response will not be ready in a given period of time, it does not want the response.&lt;br /&gt;
# The server returns an initial response (without delay) that indicates the request has indeed resulted in an asynchronous response and provides the client with a URL and time estimate. &lt;br /&gt;
# The client reads the time estimate and waits...&lt;br /&gt;
# The client dereferences the URL and gets the response.&lt;br /&gt;
&lt;br /&gt;
; Examples&lt;br /&gt;
: A  DAP4 server that is retrieving data content from a near-line tape storage subsystem might take several minutes to access a particular data holding. &lt;br /&gt;
: A DAP4 server that is providing access to data held in an Amazon Web Services Glacier Vault will have to wait ~4 hours before it can retrieve a particular holding. &lt;br /&gt;
In these circumstances the server may return the DAP4 Asynchronous Response.&lt;br /&gt;
&lt;br /&gt;
The remainder of this section will expand on this basic workflow using examples that focus on the HTTP protocol but that also allow for the use of other transport protocols.&lt;br /&gt;
&lt;br /&gt;
== Client willingness to accept asynchronous responses ==&lt;br /&gt;
A client can indicate willingness to accept asynchronous responses in one of two ways:&lt;br /&gt;
* By including the [[#Accept DAP Asynchronous Response|X-DAP-Async-Accept]] HTTP header.&lt;br /&gt;
* By adding the [[#DAP4_Constraint_Expression_extension_for_Async | dap4.async]] keyword to the DAP constraint expression.&lt;br /&gt;
&lt;br /&gt;
If the client indicates that it must have access to the asynchronous response content within a certain time (utilizing either the  [[#Accept DAP Asynchronous Response|X-DAP-Async-Accept]] HTTP header and/or the [[#DAP4_Constraint_Expression_extension_for_Async | async]] keyword in the constraint expression) and the response will not be available in that time frame, the server MUST reject the request and return an HTTP status of [[#412_Precondition_Failed | 412]] and the [[#DAP Asynchronous Request Rejected | DAP Asynchronous Request Rejected]] XML document.&lt;br /&gt;
&lt;br /&gt;
If both the &#039;&#039;X-DAP-Async-Accept&#039;&#039; HTTP header and the &#039;&#039;dap4.async&#039;&#039; keyword are used, the keyword takes precedence.&lt;br /&gt;
&lt;br /&gt;
Servers must reject requests that require an asynchronous response if the client has not indicated willingness to accept such a response. Rejection of such requests is indicated by all three of the following:&lt;br /&gt;
# [[#400 DAP Asynchronous Response Required| HTTP status of 400]]&lt;br /&gt;
# Inclusion of the [[#DAP Asynchronous Response Required|X-DAP-Async-Required]] HTTP response header&lt;br /&gt;
# The response body must contain the [[#DAP_Asynchronous_Response_Required | DAP Asynchronous Response Required]] XML document. &lt;br /&gt;
This safety check (requiring clients to explicitly indicate their willingness to accept asynchronous responses) is required because otherwise very simple clients might inadvertently make requests that will result in an asynchronous responses, and these kinds of responses are likely to use disproportionately (relative to synchronous responses) more server resources. We want to make DAP4 so that simple clients work well and don&#039;t encounter unexpected &#039;hiccups.&#039;&lt;br /&gt;
&lt;br /&gt;
== Initial processing by the server ==&lt;br /&gt;
When a request is accepted by the server and it will result in an asynchronous response, the server MUST return a 202 (Accepted) HTTP status code and the [[#DAP Asynchronous Request Accepted | DAP Asynchronous Request Accepted ]] XML document. This document contains a URL to the pending result of the request.&lt;br /&gt;
&lt;br /&gt;
Of course, this discussion is about the mechanism that enables a client to make a request and the server to provide &#039;&#039;information about&#039;&#039; an asynchronous response to that request. It does not cover any of the nearly infinite ways a server might actually make the &#039;&#039;content&#039;&#039; of that response. It is likely that servers will write the responses to files and the URL returned to the client will be used to retrieve that file, but there&#039;s no requirement that servers do that. The only requirements on server are that:&lt;br /&gt;
#The URL returned asserts, using the [[#DAP4_Constraint_Expression_extension_for_Async | constraint expression syntax for async]] that the client accepts async responses.&lt;br /&gt;
# The URL returned can be dereferenced and that operation will return the response requested by the client.&lt;br /&gt;
&lt;br /&gt;
== Response retrieval by the client ==&lt;br /&gt;
When a client requests an asynchronous result that is ready, the server MUST return a 200 (OK) HTTP status code and the resulting data response. If the client attempts to access the asynchronous result prior to it&#039;s availability, the server SHOULD return an HTTP response status of  [[#409_Conflict_-_DAP4_Response_Not_Ready | 409 (DAP Response Not Ready)]] along with the [[#DAP4_Asynchronous_Response_Not_.28Yet.29_Available | DAP Asynchronous Response Not Available]] XML document. If the server does not return the 409 response status then it MUST return a 404 (Not Found) response along with whatever document it deems fit as the response body.&lt;br /&gt;
&lt;br /&gt;
If the client attempts to access the asynchronous result after it is no longer available, the server SHOULD return an [[#410_Gone_-_DAP4_Response_No_Longer_Available | HTTP response status of 410 (Gone)]] along with the [[#DAP4_Asynchronous_Response_Gone| DAP4 Asynchronous Response Gone]] document. If the server does not return the 410 response status then the server MUST return a 404 (Not Found) response along with whatever document it deems fit as the response body.&lt;br /&gt;
&lt;br /&gt;
In each case above where the server SHOULD return a specific error code, but may return a 404 code instead, the intent is for servers to provide the most appropriate use of HTTP/1.1&#039;s error codes while also providing servers with an &#039;out&#039; when that is hard for them to do. For example, knowing that a response, which is essentially ephemeral, is gone would, in theory, require to server to keep a record of every URL ever issued for an asynchronous response and that is not practical. At the same time, it is easy to see that a client would really like to know that the response has not yet been finished (i.e., it has not waited long enough) or that it is gone (i.e., it waited too long).&lt;br /&gt;
&lt;br /&gt;
== Detail: Client requests ==&lt;br /&gt;
&lt;br /&gt;
=== DAP4 Constraint Expression extension for Async ===&lt;br /&gt;
By adding a keyword/value pair to the DAP4 query string we can allow a client to encode it&#039;s willingness to accept an asynchronous response, along with the a maximum amount of time the client can wait before it can access the response. &lt;br /&gt;
&lt;br /&gt;
; dap4.async&lt;br /&gt;
: A value of zero indicates the client is willing to unconditionally accept an asynchronous response. A positive integer value will be interpreted as the number of seconds that the client will wait for access to the response. If the value is negative the serve MUST return an error. &lt;br /&gt;
&lt;br /&gt;
; Examples&lt;br /&gt;
: Client is willing to unconditionally accept an asynchronous response&lt;br /&gt;
:: &amp;lt;code&amp;gt;?dap4.async=0&amp;lt;/code&amp;gt;&lt;br /&gt;
: Client is willing to wait for 60 seconds for access to the asynchronous response&lt;br /&gt;
:: &amp;lt;code&amp;gt;?dap4.async=60&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== X-DAP-Async-Accept ===&lt;br /&gt;
&lt;br /&gt;
A client may indicate willingness to accept asynchronous responses by including the &#039;&#039;X-DAP-Async-Accept&#039;&#039; HTTP header. Clients can make conditional requests for asynchronous responses by indicating the maximum time they are willing to wait by using the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; HTTP header with a value given in seconds. A value of zero indicates that the client is willing to accept whatever delay the server may encounter.&lt;br /&gt;
&lt;br /&gt;
== Detail: Server responses ==&lt;br /&gt;
&lt;br /&gt;
Several &#039;experimental&#039; HTTP headers are used by this design. They convey information either in the request (like the &#039;&#039;X-DAP-Async-Accept&#039;&#039; described above) or they encode information for a response. While only clients that intend to support asynchronous responses need to understand all of these, &#039;&#039;every&#039;&#039; client SHOULD understand the &#039;&#039;X-DAP-Async-Required&#039;&#039; header. Because we need to support clients like web browsers, knowledge of that header is not required, but DAP4-specific clients will provide the most information to users if they know to look for at least that response header.&lt;br /&gt;
&lt;br /&gt;
=== HTTP Response Headers ===&lt;br /&gt;
==== X-DAP-Async-Required ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;X-DAP-Async-Required&#039;&#039; HTTP response header is included in the response if the request requires an asynchronous response and the client has not indicated willingness to accept such a response. Rejection of the request should also be indicated by the [[#400_DAP4_Asynchronous_Response_Required |400 DAP Asynchronous Response Required]] HTTP response code.&lt;br /&gt;
&lt;br /&gt;
==== X-DAP-Async-Accepted ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;X-DAP-Async-Accepted&#039;&#039; HTTP response header is included in the response if the server has accepted an asynchronous request. Acceptance of the request should also be indicated by the [[#202_Accepted|202 Asynchronous Request Accepted]] HTTP response code.&lt;br /&gt;
&lt;br /&gt;
=== HTTP Response Codes ===&lt;br /&gt;
&lt;br /&gt;
HTTP provides a number of response codes beyond the simple 200 (OK), 404 (Not Found) and 500 (Internal Server Error). In this design we describe how those standard codes SHOULD be used by DAP4 servers. We don&#039;t enumerate all of the possible codes, instead opting for a description of those that most relevant.&lt;br /&gt;
&lt;br /&gt;
==== 202 Accepted ====&lt;br /&gt;
&lt;br /&gt;
A server indicates that a request has been accepted and will be handled asynchronously by returning a &#039;202 Accepted&#039; HTTP response code. The response body must contain a document in one of the asynchronous information media types listed [[#Media Types|below]]. A server MUST return this response, and only do so, when a client has indicated a willingness to process an asynchronous response and the response will actually be returned using the asynchronous mechanism.&lt;br /&gt;
&lt;br /&gt;
==== 400 DAP4 Asynchronous Response Required ====&lt;br /&gt;
&lt;br /&gt;
The &#039;400 DAP Asynchronous Response Required&#039; HTTP response code is used to indicate that the DAP4 request has been rejected because an asynchronous response is required and the client did not indicate willingness to accept an asynchronous response.&lt;br /&gt;
&lt;br /&gt;
The response code text is used to indicate the reason for the rejection. However, since the &#039;400&#039; HTTP response code is not specific to asynchronous DAP (the standard text for the &#039;400&#039; code is &amp;quot;Bad Request&amp;quot;), the &#039;&#039;X-DAP-Async-Required&#039;&#039; HTTP response header is also included in the response (see [[#Accept DAP Asynchronous Response|above]]).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that a standard 400 HTTP response code is returned. In this way, a client that does not understand asynchronous DAP can fail gracefully. The response code text message has been changed to be more informative of the reason for the failure. For clients that are aware of asynchronous DAP, the &amp;quot;DAP-Async-Required&amp;quot; header is set to &amp;quot;true&amp;quot;. The body of the response also returns some information the client can use to decide on how it will continue.&lt;br /&gt;
&lt;br /&gt;
==== 409 Conflict - DAP4 Response Not Ready ====&lt;br /&gt;
&lt;br /&gt;
The &#039;409 Conflict&#039; HTTP response code MAY be returned by a server to indicate that the DA4P request has been rejected because a previous asynchronous request has not been completed and the result is not ready for access. If a server utilizes the &#039;409 Conflict&#039; HTTP response code it must also return a [[#DAP4_Asynchronous_Response_Not_.28Yet.29_Available | DAP4 Asynchronous Response Not Yet Available]] document in the response body.&lt;br /&gt;
&lt;br /&gt;
==== 410 Gone - DAP4 Response No Longer Available ====&lt;br /&gt;
&lt;br /&gt;
The &#039;410 Gone&#039; HTTP response code MAY be used by a server to indicate that the result of an asynchronous request is no longer available. If a server utilizes the &#039;410 Gone&#039; HTTP response code it must also return a [[#DAP4_Asynchronous_Response_Gone | DAP4 Asynchronous Response Gone]] document in the response body.&lt;br /&gt;
&lt;br /&gt;
==== 412 Precondition Failed====&lt;br /&gt;
&lt;br /&gt;
The &#039;412 Precondition Failed&#039; HTTP response code is used to indicate that the DAP request has been rejected because it did not meet the &#039;&#039;&#039;X-DAP-Async-Accept&#039;&#039;&#039; condition (see [[#Accept DAP Asynchronous Response Conditionally on Estimated Time to Completion|above]]) that was specified in the request.&lt;br /&gt;
&lt;br /&gt;
==== 500 Internal Error====&lt;br /&gt;
&lt;br /&gt;
The &#039;500 Internal Error&#039; HTTP response code is used to indicate that the DAP request has caused an error on the server. The request body and other headers must be compliant with the [[DAP4_Web_Services_v3#DAP4_Error_Response | DAP4 Error Response]] and [[DAP4_Web_Services_v3#Status_Codes | Status Codes]] sections of the [[DAP4_Web_Services_v3 | web services specification]]. The request should not be repeated.&lt;br /&gt;
&lt;br /&gt;
=== Asynchronous Response Documents ===&lt;br /&gt;
&lt;br /&gt;
The uses of these documents are:&lt;br /&gt;
* to inform clients that a request will result in an asynchronous response;&lt;br /&gt;
* to provide clients with the status of an an accepted asynchronous request; and&lt;br /&gt;
* to inform clients that a request for and asynchronous response has been rejected.&lt;br /&gt;
&lt;br /&gt;
These response documents are the payloads to various responses, including errors. By using the HTTP 400-series error response codes, the design ensures that generic web clients will understand that their request was in error (even if they don&#039;t really understand why). The text provided with the response code will be sufficient that person could understand the gist of the problem, if not more. The response documents described here, along with the &#039;&#039;X-DAP&#039;&#039; describe above, are a way of providing additional information to a savvy client so that it can take full advantage of the synchronous response system.&lt;br /&gt;
&lt;br /&gt;
These documents are XML that follows the DAP Asynchronous XML schema and are declared in the namespace &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://opendap.org/ns/dap/asynchronous&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Required ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a request will result in an asynchronous response, and that the client has not yet indicated it&#039;s willingness to accept  an asynchronous response. It might seem superfluous to include a document that clearly only a client knowledgable about the asynchronous response features could parse, but many such clients may not, as a matter of course, indicate they will accept these responses. For example, a user-configurable parameter might be turn off support for the feature. The &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements convey information about conditions the clients can expect if it submits an asynchronous request for the response. As noted below, these are estimates made by the server since a number of things that the server cannot predict can affect them in the interleaving time between the client&#039;s requests. Additionally, a server MAY return values of zero for either of the values, indicating that it cannot make an accurate estimate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;required&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This response MUST be associated with the 400 HTTP response code and the &#039;&#039;X-DAP-Async-Required&#039;&#039; response header.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Request Accepted ====&lt;br /&gt;
&lt;br /&gt;
This response informs clients that a request resulting in an asynchronous response has been accepted, along with operational information about retrieving the asynchronous response result. Note that the &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements are an estimate by the server. A server SHOULD ensure that the response will remain available for the time period given by &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039;. We say &#039;&#039;SHOULD&#039;&#039; and not &#039;&#039;MUST&#039;&#039; because we cannot predict all possible operational situations where these kinds of responses might be used. For example, a server might be providing access for several types of users who might have different access priorities, especially to limited resources like those typically involved with asynchronous access, and thus some responses might be further delayed, or removed early, to enable processing of requests from users with higher priority. It should be kept in mind, however, that the usefulness of the asynchronous responses will depend, in part, on servers providing a facility on which clients can depend.&lt;br /&gt;
&lt;br /&gt;
While the &#039;&#039;expectedDelay&#039;&#039; and &#039;&#039;responseLifetime&#039;&#039; elements are required, a server MAY set their &#039;&#039;seconds&#039;&#039; attribute to &#039;&#039;0&#039;&#039; to indicate that it cannot provide a reliable value. In this case, clients SHOULD poll every 300 seconds and servers SHOULD expect this behavior. This is the default TCP user timeout period (see http://tools.ietf.org/html/rfc5482).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;accepted&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;link href=&amp;quot;http://server.org/async/path/result&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This response document MUST be associated with the 202 HTTP status code and the &#039;&#039;X-DAP-Async-Accepted&#039;&#039; response header.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Not (Yet) Available ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a while a previous request for an asynchronous response has been accepted, the result is not available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;pending&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST be associated with the [[#409_Conflict_-_DAP4_Response_Not_Ready | 409 HTTP response code]]. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document and it&#039;s associated HTTP status of 409,  but servers MAY return any document in the response body along with either a a 404 (Not Found) or a 400 (Bad Request) HTTP status.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Response Gone ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a while a previous request for an asynchronous response has been accepted, the result is &#039;&#039;no longer&#039;&#039; available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;gone&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST be associated with the [[#410_Gone_-_DAP4_Response_No_Longer_Available| 410 HTTP status code]]. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document and it&#039;s associated HTTP status of 410,  but servers MAY return any document in the response body along with either a a 404 (Not Found) or a 400 (Bad Request) HTTP status.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Asynchronous Request Rejected ====&lt;br /&gt;
&lt;br /&gt;
This document informs clients that a request for an asynchronous response has been rejected, even though the client said it is willing to process an asynchronous response. There are at least as many reasons a server might reject the request for an asynchronous response as there are systems that might return such responses. However, this design provides suggested response codes for cases that seem likely so that clients can make educated decisions about the reason for the rejection. The reason codes supported are:&lt;br /&gt;
;time: The client indicated that it was only willing to wait &#039;&#039;X&#039;&#039; seconds and the server thought it would take more time to build the result.&lt;br /&gt;
;unavailable: A needed resource is not available. This might indicate that hardware, like a robot tape system, cannot be currently accessed.&lt;br /&gt;
;privileges: The client is not allowed to make the request. &lt;br /&gt;
;other: Self evident...&lt;br /&gt;
In addition to the reason codes, this response will contain a text description of the reason for rejection.&lt;br /&gt;
&lt;br /&gt;
Servers SHOULD make every effort to use the correct reason codes and provide cogent descriptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;rejected&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;reason code=&amp;quot;time&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;description&amp;gt;Acceptable access delay was less than estimated delay.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This response document MUST associated with the 412 HTTP status code. &lt;br /&gt;
&lt;br /&gt;
Servers SHOULD return this response document along with an HTTP status of 412, but servers MAY return any document in the response body along with an HTTP status of 404 (Not Found) or of 400 (Bad Request) in its place.&lt;br /&gt;
&lt;br /&gt;
==== DAP4 Error ====&lt;br /&gt;
&lt;br /&gt;
If the server encounters an error it must MUST (MAY?) return an HTTP status of 500 (Internal Error) along with a  request body and other headers compliant with the [[DAP4_Web_Services_v3#DAP4_Error_Response | DAP4 Error Response]] and [[DAP4_Web_Services_v3#Status_Codes | Status Codes]] sections of the [[DAP4_Web_Services_v3 | web services specification]]. The request should not be repeated.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response using GET ===&lt;br /&gt;
&lt;br /&gt;
; Simple Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server decides it needs to handle this request in an asynchronous manner, it will refuse the request because it did not say it would accept an asynchronous response.&lt;br /&gt;
&lt;br /&gt;
; Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
400 DAP Asynchronous Response Required&lt;br /&gt;
X-DAP-Async-Required: true&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;required&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response with DAP-Async-Accept Request Header ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
X-DAP-Async-Accept: 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap?dap4.async=0&amp;amp;dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
202 Accepted&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;accepted&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;expectedDelay seconds=&amp;quot;600&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;responseLifetime seconds=&amp;quot;3600&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;link href=&amp;quot;http://server.org/async/path/result&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NB&#039;&#039;&#039;: This example originally included an &#039;&#039;Accept&#039;&#039; header with the value of &#039;&#039;multipart/mixed&#039;&#039;. However, that is not a good example. The HTTP/1.1 specification says that when a specific media type is indicated as the only one acceptable, a server must return a 406 response code if it cannot return that media type. The meaning of &#039;&#039;Accept: */*&#039;&#039; is the same as not including the header, so I have removed the header from these examples. We need to be heads up in the ways that we suggest that header should be used by clients&lt;br /&gt;
&lt;br /&gt;
=== Constrained Data Request-Response with conditional DAP-Async-Accept Request Headers ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
X-DAP-Async-Accept: 60&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /dap/path/data.nc.dap?dap4.async=60&amp;amp;dap4.ce=/x;/y;temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
412 Precondition Failed&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;rejected&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;reason code=&amp;quot;time&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;description&amp;gt;Acceptable access delay was less than estimated delay.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/AsynchronousResponse&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Premature Request For Asynchronous Result ===&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /async/path/data.nc?dap4.ce=/x;/y/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternately, this request would produce the same result using only the URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /async/path/data.nc?dap4.ce=/x;/y;/temp HTTP/1.1&lt;br /&gt;
Host: server.org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
409 Conflict&lt;br /&gt;
Content-Type: text/xml;charset=UTF-8&lt;br /&gt;
&lt;br /&gt;
&amp;lt;AsynchronousResponse status=&amp;quot;pending&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resource Role ==&lt;br /&gt;
&lt;br /&gt;
DAP4 Asynchronous Responses are identified by the resource role:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://services.opendap.org/dap4/async&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Normative Encoding of the Asynchronous Response ==&lt;br /&gt;
&lt;br /&gt;
The normative XML representation for the Asynchronous Response is defined in Appendix x &amp;quot;Normative XML Encoding of the Asynchronous Response&amp;quot;. The media type for the normative XML representation is:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;font size=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;code&amp;gt;&#039;&#039;&#039;application/vnd.opendap.dap4.async.xml&#039;&#039;&#039;&amp;lt;/code&amp;gt;&amp;lt;/font&amp;gt;&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
	<entry>
		<id>https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10556</id>
		<title>DAP4: Specification Volume 3</title>
		<link rel="alternate" type="text/html" href="https://docs.opendap.org/index.php?title=DAP4:_Specification_Volume_3&amp;diff=10556"/>
		<updated>2014-07-04T01:54:33Z</updated>

		<summary type="html">&lt;p&gt;DennisHeimbigner: Created page with &amp;quot;DevelopmentDAP4  &amp;lt;&amp;lt; Back to OPULS Development&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  &amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;DAP4 Extensions&amp;lt;/font&amp;gt;  Volume 3 of th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development|Development]][[Category:DAP4|DAP4]]&lt;br /&gt;
[[OPULS_Development| &amp;lt;&amp;lt; Back to OPULS Development]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;DAP4 Extensions&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Volume 3 of the DAP4 specification addresses the detailed semantics and structure of the DAP4 data and metadata content, this volume (Volume 2) details the manner in which clients can request things from a DAP4 server and what things the clients can expect to receive from a DAP4 server in response to their requests. The description of this interaction focuses on DAP4 clients and servers that are communicating via HTTP, and while this is perceived by the authors as the most common transport for DAP4 client/server interaction the specification is written in a broad enough manner to allow for other transport mechanisms.&lt;br /&gt;
 &lt;br /&gt;
Authors: &lt;br /&gt;
: Ethan Davis&lt;br /&gt;
: James Gallagher&lt;br /&gt;
: Dennis Heimbigner&lt;br /&gt;
: Nathan Potter&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;/div&gt;</summary>
		<author><name>DennisHeimbigner</name></author>
	</entry>
</feed>